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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================7 M7 l: @. v, B: |& B" f& Z2 V
  2. 1 a8 q8 h5 X& r3 o" F
  3.   Sion Mouse System v1.3e  x4 [; @6 n# g$ v& ~5 o
  4.   
    7 K8 _1 s0 O8 p1 D5 F
  5.   Changlog" c5 t3 `6 d' r9 O) @3 K
  6.   
    * g5 @7 ^' L$ L) H# t9 w) M
  7.   2013.4.21 v1.3f& U" a; ~& N/ `, j2 F* @
  8.    
    : i# q, b2 ^# s
  9.     1.3f 卷动地图 bug 修正
    ' W7 m2 `3 O7 S2 c+ {3 W$ {
  10.     : p+ R" G5 n* ?7 p9 N3 `8 N6 |
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口0 H7 P" a) S  \7 U( u' n, Y  z  u# u
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内2 F. m4 w9 S& _3 i" P5 I
  13.                               Mouse.unlock_mouse_in_screen 解除锁定0 G) ?, k2 E. K0 g0 V
  14. ( i" R  U  L4 H9 E: a' O. b
  15.     1.3f bug修正
    / S- [$ s) r. u& U
  16.   " x2 Y! X7 D) X( \( N
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及1 ^8 E0 D3 c5 o$ Z( }! u. B5 a
  18.           关闭菜单时,鼠标是否移动到原来的位置。
      K+ Q( y5 C: w' G& F
  19. 3 }- K. W: Q; f0 _3 ~; N
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    & X8 C: i' }5 W! E1 ]0 u: p

  21. 3 }% G% {" g6 P8 W1 l
  22.     1.3b 修正一些罕见的bug;
    ( e" x6 X8 [, d

  23. ' ]# I5 L/ c% H# E& i. ?
  24.     1.3a 代码小修改;& H  |& u! W* S8 I
  25.           加入了鼠标点击启动事件的功能,
    7 I3 T" z. {* {* _
  26.           在事件中加入“注释”: 鼠标启动  ,
    - \1 F# X! q1 v+ l* P" p
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。( G7 v1 P. F# i* D
  28.   
    - K8 m! |& s) w7 _6 g
  29.   2013.2.12 v1.2, {6 ~" e  G3 k1 ]6 i, K

  30. 3 G7 p0 s; h6 M3 k) D0 c3 a' n
  31.     寻路逻辑优化;
    ) r! w' K0 P7 L. n/ U  `
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;$ G% A2 {- Z5 \* ?0 x& Q6 l
  33.     现在支持用鼠标来操作载具了。
    ! \: j- u. T  `9 H" u

  34. ; {! ~9 |2 q8 I  C
  35.   2013.2.8 v1.1! O4 l, u( k5 U# c/ _8 b

  36. + w" ^. Z/ x6 q( q% ]: k
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    9 B- F) {' x1 a) \6 H* F, G: l+ J
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;9 ^9 T- X) l! B* ~0 O8 x4 C! R
  39.     移动时,路径指示点的绘制更加稳定;" Y0 \7 c- @$ m7 O% {/ D
  40.     现在支持默认存档画面的鼠标操作了。
    ) F$ n# O% l7 }& f# I# a3 Y3 S
  41. 0 |/ O% M* `( B$ C% M% V

  42. ( z5 y1 ~& F5 f6 J
  43.   OrigenVersion4 ~7 f1 C. `" j9 Y/ F* H
  44.   
    4 s) Y8 T! v  X; p
  45.     2013.2.7 v1.0 6 W& I; g% T$ w3 M% ]* U
  46. ) H7 k5 W! k, r9 e8 X
  47.   主要功能
    ; E1 B7 Q& ^) ^) G

  48. ; ]# _& Q. b7 R$ [
  49.       使用鼠标进行各种操作...
    / _& o, v9 Q+ B0 B/ ?
  50.       将鼠标锁定在游戏窗口内4 \( o  Q3 U, @# n, F
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    1 T4 S9 @1 [; B% ?* {' A' U  c
  52.       双击鼠标进行冲刺4 I: {; I+ F7 T: s: Q
  53.       更改地图卷动方式以适应鼠标移动
    $ V( j/ ?, J- t  L4 m% u! o
  54.       变量输入框改良
    0 n4 w, ~9 a8 E  Z& k
  55. + L6 M6 s6 s( `) S8 v8 k
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹& C$ I" |# Q( `1 Q. ?

  57. # e& J1 n& R5 X" G6 n8 K$ X( M8 {8 L9 A2 h
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    : ?% h0 a4 ~* q4 g" `
  59. 9 [' Z; C: G3 C
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    0 E- U: S. U( _& C

  61. . z2 j6 N' G% E# S% l
  62. , s+ c1 P! s! d
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    4 R, _: R% K' f6 w8 C

  64. 2 [- Z! R  h$ a1 X8 H2 _
  65. 0 p2 }; y: Y" l/ C6 F+ w
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示- k) }6 L: s" [2 D; |6 w$ v
  67. + m$ [  G" j7 I3 ^# G: s
  68. #==============================================================================
    # I  R$ b$ |; \  B2 c
  69. # ■ 常数设置 ' T0 Y% E9 m! U+ i9 ^! U: T% k% _
  70. #==============================================================================
    2 C: J. h9 f$ Y  @( c! N5 X) [! v& n
  71. module KsOfSion, [' b$ ?$ @4 \7 I! T
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false8 F) }, O1 Y( {+ r7 `' d3 Y
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    5 N6 W0 m2 q  u- _
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    3 K& L8 v+ v5 I- N1 w; R7 h
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量# I6 C# J- B. @
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ) I, n& Y+ _  U
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    # Y9 Z6 U5 g/ q. ]0 W& j
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    : J4 O  `, j  B2 w
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键& _0 f* X$ n1 [0 k; @" E
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    ! u% n1 Q9 s# u$ t; o6 ^
  81. end9 B( E* V) J$ U$ I2 B9 b
  82. - G4 l- n$ l; ]9 j. d
  83. #==============================================================================
    ( i/ R  w7 H8 t( }9 q/ T' g* Y. ?
  84. # ■ 用来显示路径点的类
    6 d$ m: H4 ~3 w* c: R0 \
  85. #==============================================================================
    % O- y6 `5 e( G+ {( T
  86. class Move_Sign  Game_Character
    # _9 }$ z2 z) Y; o4 ^4 b6 c7 e
  87.   #--------------------------------------------------------------------------& e& ~' y$ l' X! E+ [% w
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图/ Q! z+ T+ L6 |. i  j& B% z
  89.   #--------------------------------------------------------------------------
    2 S9 F7 x" T; n5 t' [
  90.   def init_public_members/ g$ Y& Q) \3 ^" _
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹* Y: x- J5 ]2 b
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为07 v4 S( G  A( f7 ]7 G' [. q: e2 M
  93.     @move_speed      = 5        # ★ 踏步速度$ W) w* _/ O8 H& G& M, g/ G! s
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)& B  Q% t, v8 i- _& {
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    - u; f2 X0 ~# }
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    : ~, Q; n+ F5 L  P9 L6 ]! W
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列# {: t3 U- B4 K3 A9 n$ y
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    1 Q! c5 ^, `4 D# w- P
  99. ( Z) c5 N6 h) t1 J& n" s
  100. " I  v8 n* P) C! g; F. L; ~
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
      w5 {, w( z. N: i! x. L) o
  102. 7 [. F0 L( X& c3 t; [1 B
  103. * [- `$ x5 B9 l' `: ]/ \6 p
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    4 K# h3 c% D' q1 V; h) i) r' ?
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')8 Y2 }4 D6 w+ I2 H+ a

  106. 0 `/ M" G" e9 P6 L0 I
  107.       if $no_arrowpic_warn
    9 {1 K) G$ H  ]% |# @
  108.         MouseShow_Cursor.call(1)" U: b" D. G% {* A) a
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    ) n9 @2 ]1 B& X+ n0 w( k* x) }. z
  110. # h+ P7 A2 _8 [  o3 R5 X
  111. “路径指示点”将使用游戏自带图片2 l+ T0 M( K) H% S
  112. & q) E& r$ `& r+ Q+ n1 s0 G
  113. 该提示可以在脚本内关闭')
    % F- I9 G3 I; l* S
  114.         MouseShow_Cursor.call(0)
    8 M9 z. A" w0 \( b5 p
  115.         $no_arrowpic_warn = false! g9 C5 g$ A0 L3 R8 ~1 K6 b# I
  116.       end" a' R7 A0 _/ P! r' h  A4 Q
  117.       @character_name  = '!Flame'
    0 B# t% f) v( J! h" @
  118.       @character_index = 6
    ' D: Y4 L! m& D, `
  119. 3 @! i: `! n" g6 L6 ~
  120.     end) b! E' N- y1 G) }: p' u
  121.     @direction_fix = false  # 固定朝向5 q9 K6 t+ t; W/ X/ q! j4 v
  122.     @move_frequency = 6     # 移动频率
    5 K! K. z/ Q4 R% ~
  123.     @walk_anime = true      # 步行动画2 f' A0 {3 o2 K' `& n9 v  a
  124.     @pattern = 1            # 图案
    ( e% |1 l1 ~% p1 M( y
  125.     @through = true         # 穿透, J4 C* B9 h( k7 @
  126.     @bush_depth = 0         # 草木深度( I4 L/ z- `) Z: I" o, _. M
  127.     @animation_id = 0       # 动画 ID, i5 n% q* l  c# R3 \) C% V
  128.     @balloon_id = 0         # 心情 ID2 d  w( [' u$ o1 ~2 q6 }- ~
  129.     @transparent = true     # 透明
    9 O2 ]& i: {; v8 ?
  130.     @id = 0; ^+ ]) t/ X2 [  F$ H
  131.     @x = 0
    ; L: `/ m+ d8 d8 Z; b6 P. j
  132.     @y = 01 g: ]& N- _/ t3 s+ m
  133.     @real_x = 0
    ! q. `* V& O2 H! W+ a  Q
  134.     @real_y = 06 S4 P0 J8 W: T3 K- b& b5 P
  135.     @tile_id = 0
    ) D, M2 ?4 `( P4 ?7 g
  136.   end0 z' N* A; l; C  n8 ]
  137.   #--------------------------------------------------------------------------
    3 B: ]; u# y2 b* V8 }& x4 [
  138.   # ● 定义实例变量
    & j4 q: ]- `8 J' z) F  B- A
  139.   #--------------------------------------------------------------------------
    8 d) @" z3 ]" S3 n
  140.   attr_accessor direction! e0 V" V( }7 c9 s% x! d$ H
  141. end
    , p3 w  [0 `: t! j2 z, V9 _7 E

  142. 1 H" b2 V! @# Z7 v. B2 }
  143. #==============================================================================
    - E- e; i' [' Y9 W! a$ _) a/ j
  144. # ■ Module Mouse
    # {' K. L. ^$ H) b8 [
  145. #==============================================================================& \$ l/ V, w( r" d' [! b
  146. module Mouse& @# f' @! S  n% N
  147.   #--------------------------------------------------------------------------
    & q$ b7 Q7 S2 K+ X$ H* j
  148.   # ● API5 V; R2 j5 ^$ @
  149.   #--------------------------------------------------------------------------5 k$ u4 W' ^: I$ Z
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    9 C" q6 T7 [3 ?" {; ^4 ~/ m+ Z2 n
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')+ n7 n1 p+ {% c$ W3 |  F
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l'). a+ w9 t( [1 N8 n' O" q, U6 c
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')6 I, F" z7 x1 d8 `# O* y. t
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    : _( @5 t- C" ^9 e0 n; ]
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')/ z/ ]0 M0 |$ ~: _% w0 e
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')# ^6 N# B, I+ x
  157.   Window_Hwnd       = Get_Active_Window.call
    ; K; ^* c0 O$ @1 y  A

  158. # Z* l4 a6 L2 L7 U
  159. class  self4 P# m+ n/ r( Y7 O
  160.   #--------------------------------------------------------------------------2 U* n3 k+ w! m- h1 e
  161.   # ● 初始化
    ; w  h1 K+ W8 b* ~; o* j9 `
  162.   #--------------------------------------------------------------------------4 B- w2 K) l! ^  E: ]+ ?9 J
  163.   def init
    + [' t7 U  O  u' g) m  y4 a
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor: y3 K7 |* N! W, f4 B1 d, |
  165.     @left_state = 0
    + H# N, ~7 n. u8 `$ W  O/ T
  166.     @right_state = 0
    1 X1 A; f  f" W% M
  167.     @ck_count = 0 # 帧数计,单击以后从0开始1 D) u) m9 M1 c8 Z) K& R; B! l
  168.     @dk_count = 0 # 用于双击的判定
    ) Y& g' a# h% A+ P
  169.     @clicked = false
    . s+ d+ G" M% T: g) k0 k6 ]
  170.     creat_mouse_sprite# W! [% I- i' G$ J
  171.     update
    # N9 w4 n& Q& _6 f/ x$ A  G/ w7 }9 |
  172.   end
    " o" R  e) Z8 S, m( k% K
  173.   #--------------------------------------------------------------------------( E, }& |/ t7 ?2 m, k- A4 T
  174.   # ● 鼠标指针精灵
      j) J" N& s- N+ L0 ~4 g+ A& ]
  175.   #--------------------------------------------------------------------------) e: ^+ j! a& z! A) T
  176. #~   def creat_mouse_sprite" J2 l% r3 {, `" I
  177. #~     
    : S$ B7 ~) M( a7 @- h5 i
  178. #~       @mouse_sprite = Sprite.new% M/ m6 ?! s. j8 V0 A2 \
  179. #~       panda = 2#rand(2)+1
    * b4 A% k- ]& g0 M# W3 t

  180. & W# r+ l- H9 c4 K& H- J% ~" D* b; R6 @
  181. #~      if panda = 1
    " b( R( Y3 q6 N; u1 ^" p  P, o2 ^
  182. #~        if File.exist('GraphicsSystemCursor2.png')7 A, ?( ^6 Q. P9 Q3 C& E- A- r+ M
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    $ _0 R( D) S6 G" Q8 P! k  x# G
  184. #~        end#with if File.exist: R% y1 R1 y$ Q$ a
  185. #~    6 K+ S: a5 b' H2 L, ?; E
  186. #~     else if panda = 2 #with if panda=1# K1 r9 y: O2 V) l
  187. #~      
    - W* O( T! y1 D. e1 p
  188. #~      if File.exist('GraphicsSystemCursor2.png')% F! ^2 y6 t7 u' S
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')" q, T1 h. \" `) q' `4 f
  190. #~      end#with if File.exist" I7 J5 @$ g2 k% O# Q4 S; U
  191. #~       - `8 i) F9 \; G" `6 \3 h
  192. #~     else #with if panda=1
    + H6 i' I- b; a
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)* `4 u% \# s  e9 g8 d* k* x2 h7 a
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),& W# f  I) X: V9 J% F, L3 n
  195. #~       Rect.new(5  24, 24  24, 24, 24)); @/ b% e$ X8 f" l) X# z' v8 b
  196. #~     end#with if panda=1- K( W5 S1 C' i+ P
  197. #~     
    ( T+ E: y! V# ?4 m, P4 {
  198. #~     #with def$ Y! `" n# J! b3 _
  199. #~   end
    4 \* B- K. b) w' V! S2 r' H
  200. def creat_mouse_sprite0 K3 N6 t8 u1 Z
  201.     @mouse_sprite = Sprite.new8 l* j+ j, b* r) Q7 X" W8 D& E
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})' ]1 e, \8 v& M9 p( @) v* E% n1 N' @
  203.     @mouse_sprite.z = 99997 |/ |: P& Z$ \% F, W
  204.     Show_Cursor.call(0)
    2 ?9 \/ _) ]* w+ L' G) k" C
  205. end
    * l7 ]2 q' B2 v7 V0 l' k2 K5 B

  206. ! k1 Z5 s4 K  z0 r/ y
  207.   #--------------------------------------------------------------------------
    0 v) [( Q9 F, B: M7 I) p. x" }
  208.   # ● 更新% N, b. g' r3 p" P
  209.   #--------------------------------------------------------------------------# Z) k: H4 j& [6 W2 O; z+ k
  210.   def update1 k0 U! U/ g0 y: {3 a/ L2 a
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    * S, n7 S. r) }
  212.     left_state  = Get_Key_State.call(0x01)2 ~7 z. |+ O+ |1 p* x
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0* @7 R- Y5 D& f  q! Z* z# `
  214.     right_state = Get_Key_State.call(0x02)4 o; |0 X0 ^( h5 b1 G. w" `3 q
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0' t7 M0 I+ q0 l7 @
  216.     update_double_click, r4 h* b# X/ W9 I/ }2 }& `
  217.     @left_state == 1  @ck_count = 0  @ck_count += 16 ~" U  _" G& ~* R& ~: g; v
  218.   end
    " d0 p. x& q! U, e
  219.   #--------------------------------------------------------------------------( d" a6 j; \! q; X, Q
  220.   # ● 获取鼠标坐标
    " Z$ O( U1 G6 ^/ k" O
  221.   #--------------------------------------------------------------------------
    3 E- ^# k! L& x8 C
  222.   def get_mouse_pos
    * n# N3 E# H4 P+ \. H
  223.     arg = [0, 0].pack('ll')
    6 X+ I0 m+ ^. e. h* ^  a
  224.     Get_Cursor_Pos.call(arg)) `0 G. Z$ ^) I3 l9 Y) H
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    " g1 _& x' K: s0 }
  226.     x, y = arg.unpack('ll')
    + m" ]9 |) n. o, A
  227.     return x, y
    9 q  V/ e3 n# x5 }
  228.   end
    ( f+ s$ L9 C0 y' k0 @! B
  229.   #--------------------------------------------------------------------------$ E2 Y7 @1 ^0 @8 L1 u
  230.   # ● 将鼠标固定在屏幕内
    0 L6 r/ k: W7 ^* w) b9 u0 c1 c
  231.   #--------------------------------------------------------------------------
    " M7 F; `3 A: x+ {$ g
  232.   def lock_mouse_in_screen7 q- Y) O% w* }8 K' o
  233.     arg = [0, 0].pack('ll')% u( W8 D$ W7 Q
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    + |6 y$ J* L$ {* g/ e
  235.     x, y  = arg.unpack('ll')0 t1 o/ P; E3 R
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))$ B) w# f: N" n0 R7 B) z
  237.   end9 Q9 _3 C8 |) g$ f! j0 @
  238.   #--------------------------------------------------------------------------* C$ k+ ~9 N  ]1 a% z: n! h8 M: `
  239.   # ● 解除鼠标固定
    % i6 v" g0 |  T/ ~( L
  240.   #--------------------------------------------------------------------------
    & z( z& V0 T- ^4 j& p4 N7 b
  241.   def unlock_mouse_in_screen
    ( z0 q7 h, Y( `
  242.     Clip_Cursor.call(0)
    ) r* U. g6 n" w8 f! ?: P
  243.   end% P9 p; w) _0 \7 ?0 S8 E
  244.   #--------------------------------------------------------------------------
    - ?7 y' |0 v5 c# w
  245.   # ● 鼠标双击判定
    % F6 @3 B& @$ G' r! c
  246.   #--------------------------------------------------------------------------
    $ N1 ~; H5 u# d
  247.   def update_double_click! ?* t/ F0 _! V& n) ^0 M$ b
  248.     @clicked = true if @left_state == 1+ Z, h8 t. a/ L  H+ l: x& }4 U
  249.     if @dk_count  0 && @left_state == 12 N7 [& y. q+ j! W) X
  250.       @dk_count = 0; @clicked = false
    , q+ g7 I0 E* G" L7 [
  251.       return @double_click = true
    * Y/ i* {, k7 b  Q# w4 W
  252.     elsif @clicked  z6 J% A+ @' e. x
  253.       if @dk_count  KsOfSionDbclick_Frame
    $ [9 J* @8 ]/ i* w( F1 `4 G
  254.         @dk_count += 1
    2 ^4 v7 }; ?2 Q3 V
  255.       else2 @7 n1 v4 A) L9 d% E: b+ C) l9 D
  256.         @dk_count = 0; @clicked = false* L) y; J/ Y8 U; S7 g
  257.       end: A7 K+ O) @% ~! N4 \0 L4 M
  258.     end0 C5 P4 D# g+ u# N% n
  259.     @double_click = false
    + O2 T- G1 q; A6 r5 P, e" ]
  260.   end
    ' L& ?4 B' E6 a: C# Z/ ~( O
  261.   #--------------------------------------------------------------------------% s" y* k9 A5 }2 Z
  262.   # ● 按键被按下就返回true
    9 A6 X+ s, R. H! l
  263.   #--------------------------------------------------------------------------
    4 O0 d3 g5 j9 h3 a9 O2 O0 C
  264.   def press(button)
    6 p  H+ m# C( G) M" I5 Y
  265.     case button
    + Z4 e- g) I  f' D
  266.       when 0x01; return !@left_state.zero! |* t" f5 }6 K$ P
  267.       when 0x02; return !@right_state.zero
    " q1 e9 }/ d2 |; y& m& }0 J/ p. r7 \
  268.     end
    ) z3 f: t9 |6 O' E& J
  269.     return false! Y5 G8 z, i& o! `
  270.   end
    : W' r# T6 V& {0 g
  271.   #--------------------------------------------------------------------------
    * v: M: Q( _6 j1 N) B
  272.   # ● 按键刚被按下则返回true; N6 A$ v! |! g* k, |# D
  273.   #--------------------------------------------------------------------------
    0 H; C- o) I- F
  274.   def trigger(button)" I  @( ], O% I6 M
  275.     case button
    + v0 o3 x2 O5 ?. _) s, @2 V
  276.       when 0x01; return @left_state == 1* ?; H. W/ Z+ y) G8 V- k
  277.       when 0x02; return @right_state == 1& ?, l( @$ D2 ?( c! l7 u
  278.     end
    % x0 Z# S: N" Q0 J/ l1 V
  279.     return false; f; m2 x- v* p+ s
  280.   end4 e4 x* |1 ^2 r5 r+ e  d$ e
  281.   #--------------------------------------------------------------------------! _7 e/ z& J0 D. z
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true9 b( K- R$ S& z, u! t) ~
  283.   #--------------------------------------------------------------------------& ^1 K/ F5 z" n# G' b4 ~
  284.   def repeat(button). P3 T8 |3 q! w' R2 ~2 g9 c' N
  285.     case button
    8 |% L: T+ r$ H8 Y$ V
  286.       when 0x01; return @left_state == 1
      C* n4 p# n. ^/ a
  287.         (@left_state  22 && (@left_state % 6).zero), L9 C* u8 r! \% J# ^
  288.       when 0x02; return @right_state == 1
    3 i# Q) r! C0 Q2 R
  289.         (@right_state  22 && (@right_state % 6).zero)
    $ x" M& k$ b( M) g  e6 z5 p8 S
  290.     end% v6 [! c- Y+ t" N! Z+ b: K
  291.     return false2 H' W7 |- `& j2 B
  292.   end
    . f/ z3 S* ^" H0 i: Y  s' e
  293.   #--------------------------------------------------------------------------+ T' [' k( l' u( L
  294.   # ● 判断是否双击鼠标. I7 W1 D/ A4 S/ G8 [" N; f1 u
  295.   #--------------------------------------------------------------------------
    ; F; D* i1 {; C2 C
  296.   def double_click0 a( @# d" h/ m$ S4 O9 u8 a8 Q
  297.     @double_click2 @- s2 S& q" y1 t# U$ `
  298.   end
    * E9 l* u! g3 f8 R% Z9 i1 E
  299.   #--------------------------------------------------------------------------2 b6 D6 g3 w: }7 y0 E0 a
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)/ x5 [2 O+ n1 j
  301.   #--------------------------------------------------------------------------
    # i! K1 T: K; J  ~
  302.   def click_count) B/ o5 n+ N9 R% o, _, J
  303.     @ck_count
    # S8 j9 i, L& ]5 W" i
  304.   end
    + y, F3 g$ H5 W
  305.   #--------------------------------------------------------------------------; }1 n' K1 l2 F# N% ?) G- @: V
  306.   # ● 获取@left_state(按住左键每一帧+=1)0 ?. D( D  U' M+ e1 p4 c% _
  307.   #--------------------------------------------------------------------------- s) `2 h. M5 T1 K0 t; ]* d
  308.   def left_state* l% A$ Q6 r6 o1 T5 l
  309.     @left_state
    + Q$ l+ f# F, C# j. t1 j' Q) i
  310.   end
    : I% E$ u- N( V6 a: y# l
  311.   #--------------------------------------------------------------------------( Q) U5 a3 u& H7 J) f  F
  312.   # ● 获取鼠标的x坐标
    ' O$ s# `% Y0 Q) I% s
  313.   #--------------------------------------------------------------------------! Q$ V- M) v* s3 Z9 I
  314.   def mouse_x
    * J* B8 x; B8 T& I! Y1 J
  315.     @mouse_sprite.x
    ; U% S+ O) j- W. v  I  P) Q
  316.   end
    . l" |* a# k! G5 y4 d
  317.   #--------------------------------------------------------------------------
    1 y" o  L, Q; h6 K9 g" @, h
  318.   # ● 获取鼠标的y坐标
    + l" B4 W+ v8 b$ R" j# F
  319.   #--------------------------------------------------------------------------
    / s* [. [4 [. ?, R2 d1 b4 @% Q# s3 A2 |
  320.   def mouse_y
    : I! M' k1 o" h  d
  321.     @mouse_sprite.y9 S" m' P; e1 X. w, D: e
  322.   end
    ) H8 F2 f: Q( {) K, `
  323.   #--------------------------------------------------------------------------
    - I4 F: n4 }& [
  324.   # ● 设置鼠标坐标
    " q7 k% B: U& I4 X8 J
  325.   #--------------------------------------------------------------------------1 S) O. u. T9 Z6 @$ n+ E; ]+ V
  326.   def set_mouse_pos(new_x, new_y)
    * T2 F+ U3 i/ m) s
  327.     arg = [0, 0].pack('ll')  u% b6 f$ O: Y! ~( s* f% y
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    8 `2 X; v9 P: c
  329.     x, y  = arg.unpack('ll')
    ) l* x6 d9 o, c3 j4 ^
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)) `$ u/ m, g: Y
  331.   end
    ' U2 n% G' Y# n. u
  332. end #end of class  self " G; u2 W- h+ {+ O1 x5 Q

  333. - K. D! b# }; u+ I0 b
  334. end' \, Q$ s: b' P
  335. 2 h% s0 r, T" I- G
  336. #==============================================================================: p5 y4 N2 j4 Z+ [9 r; g" x
  337. # ■ SceneManager
    : E! k% g# B. w& a
  338. #==============================================================================
    + E( }& {' c$ |" S" g  F
  339. class  SceneManager
    ( s5 g( d0 x0 {' {$ l
  340.   #--------------------------------------------------------------------------
    * a* k$ K4 [+ m+ g
  341.   # ● alias
    3 S( Q% k5 ~: _3 t2 \
  342.   #--------------------------------------------------------------------------
    , p. _; r5 {* G9 }) j
  343.   unless self.method_defined(sion_mouse_run)9 [+ [+ w% D0 Q
  344.     alias_method sion_mouse_run, run
    5 f2 h/ R8 P& ]. o4 ]+ D
  345.     alias_method sion_mouse_call, call; ?- _' d: o% `- O# R  e/ j& w
  346.     alias_method sion_mouse_return, return
    : |) d. F  `' @1 d! Z
  347.   end
    % i" a1 z( {5 w+ W$ a$ J* h% [- [
  348.   #--------------------------------------------------------------------------
      q$ L/ m: j4 h; v  z! ^4 E
  349.   # ● 运行
    " F6 D: k$ V5 h! [3 w' }
  350.   #--------------------------------------------------------------------------
    ' J( U% h+ r7 X
  351.   def run
    ( }. a) t  v2 W) o$ p; g
  352.     Mouse.init
    7 T$ O5 f5 Q6 `; D/ X' W3 p3 q
  353.     sion_mouse_run* C4 w5 e( J- |( _* K6 W
  354.   end
    # s% v, Q' ~7 D  n8 Y
  355.   #--------------------------------------------------------------------------
    1 U! [1 }( g. ^; L8 x6 C& N
  356.   # ● 切换
    7 V  O0 c  T% H; r2 {. H$ s
  357.   #--------------------------------------------------------------------------
    8 ?  g. K- B- [: }/ u6 S
  358.   def call(scene_class)% P( f0 I# q0 n3 t. G
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)) u9 a  @: V  p  ^0 r( h: J
  360.     sion_mouse_call(scene_class)9 `* J) C# t( t2 A4 l& e6 I
  361.   end; D  m0 r! V7 ^$ t- z
  362.   #--------------------------------------------------------------------------
    * M! {, ^" J+ l! f- o
  363.   # ● 返回到上一个场景1 d' M) \, x5 a( l
  364.   #--------------------------------------------------------------------------( O+ G0 v4 E; p% _% o2 ~
  365.   def return
    - m" i" D9 a% [! p# o5 f# w
  366.     sion_mouse_return+ w/ O! r7 H0 n9 \" Z
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&  H; d: P  G, v; X8 F3 U
  368.       @scene.instance_of(Scene_Map)
    3 M1 _9 D! u2 C4 U% w( j
  369.   end
    0 C7 L8 G& B. H" o
  370. end  [' X2 J6 K2 r, `5 _
  371. , W* Q/ M% e( m+ J
  372. #==============================================================================
    # O' n! v  a) C6 m& B3 H' F9 T$ K
  373. # ■ Module Input
    ; t! S5 o/ d' I6 j& a* w
  374. #==============================================================================
    7 g- R! n- Y0 l  M5 @/ H! l& \5 S% q
  375. class  Input6 I/ |2 p7 V+ ^2 `# p7 X
  376.   #--------------------------------------------------------------------------
    3 F! v+ P9 }, E, U! m
  377.   # ● alias
    ) P  {3 C7 ?% q: ?; B
  378.   #--------------------------------------------------------------------------
    & p* @2 X" @0 X% z8 B3 ]
  379.   unless self.method_defined(sion_mouse_update)- s) Z% T# q! [4 S3 l3 E
  380.     alias_method sion_mouse_update,   update
    & X& u7 b. u: r5 J0 @3 a" f
  381.     alias_method sion_mouse_press,   press
    " M- S. h6 b* t9 _
  382.     alias_method sion_mouse_trigger, trigger: {2 _2 f/ |- p
  383.     alias_method sion_mouse_repeat,  repeat: T3 w* P& K# A1 z) K
  384.   end
    - H4 j4 K% M& Y; M
  385.   #--------------------------------------------------------------------------
    1 F: p7 T$ i% ^$ |2 [
  386.   # ● 更新鼠标8 x2 R3 Q* a# j1 a/ W
  387.   #--------------------------------------------------------------------------
    , I+ P# r/ V$ _$ E  p! s9 l. A  z4 J
  388.   def update( \& s- e5 c; O- F' e* e
  389.     Mouse.update! P( g" e- `( w* A# u
  390.     sion_mouse_update
    0 S4 l1 j2 C& ?( Z+ l3 ~) v
  391.   end& Q( T6 c) L7 G2 M) U- s( T( \
  392.   #--------------------------------------------------------------------------
    ( A7 W% o1 P4 z( [. V
  393.   # ● 按键被按下就返回true- o) i9 r+ i3 M! T
  394.   #--------------------------------------------------------------------------$ t  K; W* L9 y1 K
  395.   def press(key)* I$ U! M% e, I& I
  396.     return true if sion_mouse_press(key)
    4 O; B, u" j3 o) l& @/ r
  397.     return Mouse.press(0x01) if key == C
    1 @: E  M; B# P9 M4 D
  398.     return Mouse.press(0x02) if key == B
    9 a$ `; A. I, B& f
  399.     return false
    * R$ w/ G7 U+ `/ |7 h0 x; k' M
  400.   end
    8 f$ x$ h, N1 N( @6 s+ E( c
  401.   #--------------------------------------------------------------------------
    ' E. J. C3 R1 p- r+ w; C7 t
  402.   # ● 按键刚被按下则返回true* N4 K' S" e+ f4 N  C/ C5 ^+ ?" z( |
  403.   #--------------------------------------------------------------------------3 P9 Z4 @: p0 p
  404.   def trigger(key)
    ( C$ q" D2 ]7 {) M0 c, c' H! j
  405.     return true if sion_mouse_trigger(key)
    ! E! H1 E* j, F9 {/ m8 i. \5 {
  406.     return Mouse.trigger(0x01) if key == C" n+ t: L: ~& T, s3 @
  407.     return Mouse.trigger(0x02) if key == B% ?% D9 L3 @' `! h
  408.     return false
    ; g! a' E' ?; h; P" P! z
  409.   end
    1 z1 n( Z5 G& z3 r1 V+ n- s9 l8 I# O4 ]
  410.   #--------------------------------------------------------------------------
    : F4 A# O$ W1 R0 j: z7 M
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true' f8 {" w' U1 f( N; ~
  412.   #--------------------------------------------------------------------------
    ) e) P0 _( p* |  h9 u, F, E& r$ T
  413.   def repeat(key)1 P1 |5 W0 N0 k  V6 q: z. l& O# _( C2 [
  414.     return true if sion_mouse_repeat(key)
    . g0 k- B$ E* O4 s
  415.     return Mouse.repeat(0x01) if key == C; c( w$ ^# m3 E, _
  416.     return Mouse.repeat(0x02) if key == B
    . Z! D+ y6 F; Q1 x+ O$ h; [
  417.     return false
    * _7 d7 l. h% ~2 \7 F
  418.   end0 d# t4 }" \' O* k
  419. end2 ~! j# r) ^2 s$ S
  420. 5 y3 X# G* ?. w8 I! A" l& ^% K

  421. 3 K( K# {+ U" M8 ~2 z. N+ r0 k
  422. #==============================================================================  _! f) c2 k6 H4 d' a( b
  423. # ■ Window_Selectable8 O6 R' L# A# [0 r" d
  424. #------------------------------------------------------------------------------
    4 F) Y/ H; E5 c7 D; l$ ~; u& ~& O
  425. #  拥有光标移动、滚动功能的窗口; {4 b1 r! j* m4 C( ]
  426. #==============================================================================9 b: I  b4 `1 Y' m- X/ G
  427. class Window_Selectable
    % N4 h' d' ^; ~+ a4 ^
  428.   #--------------------------------------------------------------------------
    $ \9 T* U5 P" L. J& h
  429.   # ● 初始化& }* D% Z# {( C
  430.   #--------------------------------------------------------------------------0 z& a7 s1 k2 l& X- a' i
  431.   alias sion_mouse_initialize initialize
    : ^5 S* w1 G8 k0 n6 }8 E% {
  432.   def initialize(x, y, width, height)
    5 K# l! u2 y1 }* i3 _
  433.     sion_mouse_initialize(x, y, width, height)2 U* X* d; [2 P5 Y5 t3 z9 E; p
  434.     @move_state = 0( J! W$ _9 x& L7 f
  435.   end8 Z+ {$ c% H" z9 h+ A
  436.   #--------------------------------------------------------------------------
    ! t* C0 v1 B4 C; A
  437.   # ● 更新
    ( @4 V- O# L5 ^! ~
  438.   #--------------------------------------------------------------------------
    7 X* f# z- g9 N* ]# i) K& C  r
  439.   alias sion_mouse_update update! @/ g8 y# P& @& r0 w
  440.   def update8 H; j% h0 L7 Q4 [/ K4 f' p
  441.     sion_mouse_update
    9 L0 R  y& O+ y9 X
  442.     update_mouse_cursor
    ' Y) t$ h  G+ W( x$ z0 N
  443.   end
    : l# h$ \3 W  x5 J
  444.   #--------------------------------------------------------------------------
    & z- u# h: L% {# G5 S$ t
  445.   # ● 启动后设置鼠标到index位置2 ?( `: y# v; @0 Y" ^, H
  446.   #--------------------------------------------------------------------------! `5 U0 Q; n1 u2 F) n
  447.   def activate! p7 T* W! U; Z5 m7 S
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    0 N- n  ?6 n: r( T
  449.     super$ |4 q0 E4 g6 e  w( s
  450.   end9 B# \" l, B0 e/ }0 K
  451.   #--------------------------------------------------------------------------
    1 V" a1 ^* R3 @
  452.   # ● 更新鼠标和光标的位置
    , s+ q0 Q  y0 }& R
  453.   #--------------------------------------------------------------------------; g! [7 o+ r. {5 c0 x& S# x
  454.   def update_mouse_cursor
    ; D* D+ x3 [2 l. Z
  455.     if active* o, H; M$ f- l- Q  N  @
  456.       if @need_set_pos
    8 r$ Q* S7 B8 r3 O7 ^7 d& l
  457.         @need_set_pos = nil1 a$ }- k2 e7 g! z+ G, D6 n
  458.         set_mouse_pos7 @! |) L$ ?0 [" K+ _" N& R
  459.       elsif cursor_movable
    + I" Y5 j: O. z( M
  460.         Input.dir4.zero  set_cursor  set_mouse_pos0 M, R" F" c5 x- u2 @- F  D" L
  461.       end% ?& a- m2 D% K4 `
  462.     end  v# P8 B" Y8 q8 U1 T. \
  463.   end, w1 q. }& d& ]8 u/ [
  464.   #--------------------------------------------------------------------------. j) i. E: w) I. e! T
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能. ^, T( x" t" k# M
  466.   #--------------------------------------------------------------------------- c  E3 O# S1 W4 {
  467.   def set_cursor6 t' b9 N  D, v" x
  468.     mouse_row, mouse_col = mouse_window_area
    0 i! y# L3 m: h* U$ Z. [+ ?% y
  469.     if    mouse_row == -1/ k5 C7 }. ~! ^; p- y
  470.       @move_state += 1 if need_scroll
    6 {( V5 m8 S# Q5 {
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    ! Y) y  t) y1 y  Z  i- W( D( c
  472.     elsif mouse_row == -2
    % K0 i# c9 {2 M+ N3 C. J4 f- |
  473.       @move_state += 1 if need_scroll
    3 E, ^0 R; Q% x. W# c3 P
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    7 Y/ I9 V! f7 p0 y
  475.     elsif mouse_col == -1, t$ d" I# X1 R, A; }
  476.       @move_state += 1 if need_scroll+ l8 L; U; d5 H7 y! w
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand/ [/ b& V+ c9 `$ R
  478.     elsif mouse_col == -29 \0 X4 B7 w' H: l( ^
  479.       @move_state += 1 if need_scroll( P1 r/ E5 |2 A. O
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand: m/ u4 O0 B" D& F* y. z
  481.     else
    6 V% k9 Z1 V+ ?" _( |0 \
  482.       @move_state = 0
    % R% T  t( a6 `1 g0 s
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    0 d/ ~/ b9 S8 R5 X0 `3 j
  484.       select(new_index) if new_index  item_max && new_index != @index
    ! C# p2 I: c$ f# D
  485.     end) {& Z+ ^4 p6 @  j9 _
  486.   end
    * o. e, W) F- G) ?9 ?
  487.   #--------------------------------------------------------------------------$ {9 S6 h2 q1 W8 E: o) G3 g; O- H& u$ P
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    2 u. ?7 D# F- h2 @! C' r
  489.   #--------------------------------------------------------------------------. ^: {& _/ D( u& n4 l; R
  490.   def mouse_window_area
    : x+ s7 ^' N5 ]) G0 Z) l1 r5 @
  491.     if viewport.nil # necessary!
    9 h6 w$ n1 i# K! H" T) S4 E# a: g
  492.       vp_x, vp_y = 0, 0
    6 p- \& {7 p/ U
  493.     else% U0 I1 C7 z) L$ \1 M* _
  494.       vp_x = viewport.rect.x - viewport.ox
    / Z0 X, E& I, |( K7 m* `8 }! _
  495.       vp_y = viewport.rect.y - viewport.oy3 ]1 X' s) @( i$ {+ ~- Z+ l
  496.     end' \& v2 m: m/ S8 \3 a
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ' l4 o! ^( g( Y; u3 M
  498.     item_x1 = vp_x + x + standard_padding 2 b+ T' A& e5 L2 E/ G8 ~0 a
  499.     item_y1 = vp_y + y + standard_padding
    ) u3 F# @( L5 O  C/ n
  500.     item_x2 = vp_x + x - standard_padding + width/ o; w5 Q; P0 s" o, Z
  501.     item_y2 = vp_y + y - standard_padding + height. C2 F6 v) z2 T% L
  502.     if mouse_x  item_x1% f7 t3 t( o+ j% Y1 _' Y
  503.       mouse_col = -1
    3 n" ?* U  _4 N( i$ |/ j  F
  504.     elsif mouse_x  item_x2
    9 D4 O, ^& f8 V+ |0 N+ o
  505.       mouse_col = -2
    : G  D0 W4 \+ ~. ]5 H! s
  506.     else
    7 T: b. X( ]3 I
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1), N0 @% t/ B: Z3 w4 q7 \  f
  508.     end
    8 \% e. p8 n0 r
  509.     if mouse_y  item_y16 t1 `3 c+ E/ ?9 c. `  n/ ^8 I! v
  510.       mouse_row = -1
    9 \4 D5 n$ v3 \: {
  511.     elsif mouse_y  item_y2' z' t$ c9 N# y! f3 [
  512.       mouse_row = -2
    0 M5 X3 Y9 @1 r3 o! O  Z
  513.     else
    ) I( ]  O/ M( X7 X) h0 H& M) y
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    # x4 y: G% {9 \9 W' V
  515.     end3 j% I/ C% e7 @; o, z
  516.     return mouse_row, mouse_col$ W# Z+ `& \/ G5 K$ ~5 U
  517.   end; h9 a. P( _. [
  518.   #--------------------------------------------------------------------------
    9 S1 }4 M2 F7 T( m# V
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    8 @1 ^' I* K  j# M
  520.   #--------------------------------------------------------------------------
    0 o& i9 Q2 F* m* @* h
  521.   def set_mouse_pos$ o; }8 Z# t5 }, M$ N. C0 d
  522.     if viewport.nil # necessary!- w2 _5 j( L. ~$ D* a7 _$ S
  523.       vp_x, vp_y = 0, 0
    4 c: ]$ f0 n/ ^9 o1 o. C6 `
  524.     else
    0 {5 N0 F# G/ Q7 g4 \: p) c- X
  525.       vp_x = viewport.rect.x - viewport.ox$ [4 \1 D! G- B6 k
  526.       vp_y = viewport.rect.y - viewport.oy
    & g) K0 \2 B3 @1 O' P5 z+ o
  527.     end
    $ c+ Z2 e' [2 z7 ^) c) Z! n
  528.     item_x1 = vp_x + x + standard_padding
    & i- V6 d" Y  z" `& ^. ]" S: N
  529.     item_y1 = vp_y + y + standard_padding
      F" h3 S7 }! }. _$ a
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    6 ~( z6 G( X/ c  q0 l- M
  531.     row = get_index  col_max - top_row
    8 d. p) C$ u( r# g4 j1 y  o; I* h
  532.     col = get_index % col_max
    7 F; I0 Z1 I" ]+ G" C5 o
  533.     new_x = item_x1 + item_width  (col + 0.5)/ n0 r0 B; o) W" w6 G! a
  534.     new_y = item_y1 + item_height  (row + 0.5)5 J  p% z  o& O! Q1 ?: e
  535.     Mouse.set_mouse_pos(new_x, new_y)1 y, F% v: Q2 R# v
  536.   end
    2 K; O0 r9 Q; G+ I
  537.   #--------------------------------------------------------------------------
    : X( Q& L  ?7 s3 K# E- V  W3 t
  538.   # ● 判断菜单是否需要卷动
    ' z1 X: S' n- `! J
  539.   #--------------------------------------------------------------------------
    0 p: s, o: }( L2 W& Y
  540.   def need_scroll5 `% }# l6 U/ x' ?2 v  p
  541.     item_max  col_max  page_row_max9 s$ L& h' n% D# O
  542.   end
    + m% D, C. L1 T# _+ Z; x
  543.   #--------------------------------------------------------------------------
    0 \7 p/ P, V0 J" s! `
  544.   # ● 判断是否为水平卷动菜单8 c) z6 Q) B/ {" i
  545.   #--------------------------------------------------------------------------6 ]( q, q9 |% j, _
  546.   def is_horzcommand. d7 z1 \) f5 U$ r( N
  547.     return false
    , D4 q# ~' F  }
  548.   end
    + ?9 h4 Q* l9 \6 W7 }
  549. end
    5 Q) b0 r* N; k" Z* d
  550. , x& l# g- g) j. }% z/ h& M! k
  551. class Window_HorzCommand5 r% \0 y; U' l) `; R1 y# |$ T
  552.   #--------------------------------------------------------------------------
    # G% {  V, t  M( |
  553.   # ● 判断是否为水平卷动菜单" ]: j2 o9 Z4 D( n
  554.   #--------------------------------------------------------------------------8 f" D) C9 t7 s, q2 E% l# g: x/ L/ a$ i
  555.   def is_horzcommand
    4 q) M( H% ^4 B, N3 t: A# {( O# r
  556.     return true
    ( J0 O2 ^8 h; f# P
  557.   end" ^  ]9 M  P! k! L  m, {' Y
  558. end
    % s' b: q* T' Q. l
  559.   k1 S6 E1 s4 w& f1 k+ ~
  560. #==============================================================================
    9 M0 M3 x; a# ?$ R' J* g
  561. # ■ Window_NameInput5 [# q1 t7 v) A0 M
  562. #------------------------------------------------------------------------------- a. H. ?4 g9 s/ m/ W7 N
  563. #  名字输入画面中,选择文字的窗口。
    5 K+ t2 w; `) c" u0 j5 P% t
  564. #==============================================================================* c. n- v$ Q; X* Z; K7 b7 ?. _
  565. class Window_NameInput7 U8 t: w: O- j) E
  566.   #--------------------------------------------------------------------------  q! T4 V! F) ]9 ]8 g4 Y4 \
  567.   # ● 设置列数
    : M- R( J5 G0 x9 f
  568.   #--------------------------------------------------------------------------
    0 ]+ D9 a* b% b6 ?/ m' r% v8 q' i
  569.   def col_max+ b/ G$ t+ @! a1 @2 q
  570.     return 100 H( f: K% T2 l" @' W8 \
  571.   end
    7 P% F6 f8 v. m% x$ M4 Y' u
  572.   #--------------------------------------------------------------------------
    2 }. B; ^, C% G2 G' ]+ E
  573.   # ● 设置填充的Item个数
    . O! N4 \" D( M* w, m% O4 W! c
  574.   #--------------------------------------------------------------------------
    2 L2 q2 p* G! N
  575.   def item_max( O2 R% q$ g! g& n+ I
  576.     return 90; p3 ]8 ^' c  p
  577.   end
    5 q6 F. @0 a+ T# E; X, o5 f
  578.   #--------------------------------------------------------------------------
    ) a. u/ y2 _% n- [$ |/ {2 @2 c
  579.   # ● 设置填充的Item个数
    7 }6 Y: C* X  D1 V1 t$ Y
  580.   #--------------------------------------------------------------------------
    # P* V' T% p) u  L4 }: ^. x# W
  581.   def item_width3 z. _% j& O3 A! [' E" b1 _- j( f
  582.     return 32
    ( h8 |$ |& Q3 R: C( d3 e
  583.   end9 M, }# Z* _; S1 c
  584.   #--------------------------------------------------------------------------
    " E9 o2 y: O1 x  k" `( X6 ?# N9 h
  585.   # ● 判断鼠标位于菜单的第几行、第几列, u! {+ J8 \; }: k
  586.   #--------------------------------------------------------------------------% \0 u  _3 i' \0 V' N
  587.   def mouse_window_area9 m5 f* b/ D6 a
  588.     if viewport.nil
    ( R% g$ d3 h6 K  m4 B% C
  589.       vp_x, vp_y = 0, 0
    ' s' T& Y/ B. T9 m: F' ?2 U9 w
  590.     else
    5 r' L1 ]6 G. }/ ?2 ?
  591.       vp_x = viewport.rect.x - viewport.ox; U4 W& M( I, y1 C# ]+ j+ a
  592.       vp_y = viewport.rect.y - viewport.oy
    2 s1 v1 r, m) H  D
  593.     end
    4 b/ V, w: b; u' L: p9 i
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y/ C: M- P$ V8 T* O1 U3 r
  595.     item_x1 = vp_x + x + standard_padding ( b) y) K1 Y7 c' v9 h! n% H
  596.     item_y1 = vp_y + y + standard_padding
    4 [' |/ g+ P& _  g, P1 M; t' e  U
  597.     item_x2 = vp_x + x - standard_padding + width, E9 n! p% Y$ `
  598.     item_y2 = vp_y + y - standard_padding + height
    ; r5 f* u* x4 H) F# X
  599.     if mouse_x  item_x1; S, z/ q& L3 `9 W; J- A/ b5 L
  600.       mouse_col = -15 k5 p) |; ?6 Y$ E, p+ L0 F
  601.     elsif mouse_x  item_x29 a" `) I3 _, ~- O0 M
  602.       mouse_col = -2% |  h8 ]# U" k( x) j& ^
  603.     elsif mouse_x  item_x1 + 160
    4 J2 {0 w/ D8 N1 s0 H* F
  604.       mouse_col = (mouse_x - item_x1)327 e  O. R4 j0 r6 d% m6 b9 x
  605.     elsif mouse_x  item_x2 - 160
    1 S" z, k3 C# B- \
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    2 x/ h* n1 q7 B1 |+ q5 q$ X+ n" U
  607.     else
    : Y0 L/ ]7 z) q
  608.       mouse_col = mouse_x  x + width2  5  4
    4 c1 I9 F3 g' f
  609.     end
    + o" ^( n9 y7 ?  h! q" d$ \
  610.     if mouse_y  item_y19 _$ H! U- U1 @+ h4 w
  611.       mouse_row = -1
    $ N0 T! |9 d' p; [9 E2 W
  612.     elsif mouse_y  item_y23 E% j& I) u( u0 ~9 ?$ M7 P8 f$ m
  613.       mouse_row = -2: v/ w6 {/ F, l2 J
  614.     else
    * n8 n" a2 O- g( X. D2 l$ V% M
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1): |" Y. W3 @( M5 {2 j$ u
  616.     end7 O; \; f* v# N9 b
  617.     return mouse_row, mouse_col
    , p5 F3 |: i  A1 ]7 M" \
  618.   end( `) s0 h. x1 D1 K! l( K
  619.   #--------------------------------------------------------------------------& R% \0 N& ]. F, R' _- K
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    3 X: G" I9 ~1 s4 t) W
  621.   #--------------------------------------------------------------------------
    , t. o' q6 j1 G' u8 ^9 E
  622.   def set_mouse_pos4 a9 M( r1 G# x! [- z
  623.     if viewport.nil # necessary!' q% R% j" B/ A6 |1 E
  624.       vp_x, vp_y = 0, 0
    + Z! k5 N0 p! \' m; C' M) m
  625.     else* B$ Q# W& t$ ?. q) n
  626.       vp_x = viewport.rect.x - viewport.ox$ \3 u9 K5 T- g5 K2 z% ^+ q6 Q
  627.       vp_y = viewport.rect.y - viewport.oy
    2 {- g4 \4 N0 d  j/ w
  628.     end
    % l1 t) F4 }! Q3 V' D& ]0 S
  629.     item_x1 = vp_x + x + standard_padding $ G; O- p  Z3 y4 u# e2 }
  630.     item_y1 = vp_y + y + standard_padding
    3 g, u. @& Q6 b0 ?
  631.     get_index = @index  0  0  @index 3 {4 L( U) ?/ o+ u& ?# }" f
  632.     row = get_index  col_max - top_row( s4 L6 P- x8 p9 y6 g0 ^
  633.     col = get_index % col_max- g9 G9 l8 {8 W* n# ^
  634.     new_x = item_x1 + item_width  (col + 0.5)4 p1 i  I( f$ v# w  V) C
  635.     new_y = item_y1 + item_height  (row + 0.5)
    % M! ~! [7 u! c- }
  636.     new_x += 14 if col  4
    # B2 W' D" P+ i. r  p9 p' P# O
  637.     Mouse.set_mouse_pos(new_x, new_y)4 h/ B# b' [1 G; A( Q
  638.   end
    + l1 ~" l) W7 Q4 |4 w, _! N; i
  639. end
      P7 W4 H; m; ?' ^6 y3 E

  640. # n$ ^1 u$ l9 i% ?0 @  V/ p
  641. #==============================================================================( Y, q8 N7 v% I
  642. # ■ Window_NumberInput0 w! U5 Q1 i% _" X5 J
  643. #------------------------------------------------------------------------------
    - M, Y1 s+ p/ j) d8 h& ^, }
  644. #  重写了数值输入的方法以适应鼠标
    ) H7 M/ l; W7 e( |# i
  645. #==============================================================================
    , ^0 s/ T. l+ ]' l7 m7 S( _& H+ B
  646. class Window_NumberInput  Window_Base( l4 j& h- Z1 j" J8 P9 q
  647.   #--------------------------------------------------------------------------
    9 N9 f: J+ U3 \, u( w1 |9 R4 }
  648.   # ● 定义实例变量
    : k: R' ]8 ^" e) n" y4 z8 Y
  649.   #--------------------------------------------------------------------------" W% S: H7 y4 f9 W( N
  650.   attr_reader extra_window6 }- ?8 T3 K( k' n, d( d0 {
  651.   #--------------------------------------------------------------------------
    ; C0 H( a& y. I7 \$ ]8 U; u$ j
  652.   # ● 初始化5 r6 t+ s$ O9 h( V3 P6 Z
  653.   #--------------------------------------------------------------------------4 W! L9 J+ Z' W/ u, H4 w
  654.   alias sion_mouse_initialize initialize
    3 k5 ?" g; b! c5 x+ P) I7 b
  655.   def initialize(arg)& ^. i7 z6 @, m) X0 |: \! ]9 l
  656.     sion_mouse_initialize(arg)- q) j' {4 a& R9 S
  657.     create_extra_window% i0 h7 O5 U9 A! O& G$ C' t% i
  658.   end: F: @' H' J4 z6 q" \
  659.   #--------------------------------------------------------------------------/ t1 s* |) Z$ v" f# C
  660.   # ● 启动
    2 t, W: a8 l9 s
  661.   #--------------------------------------------------------------------------
    ! x2 a. l, ]4 `8 n9 ^
  662.   alias sion_mouse_start start
    7 e" X7 P5 y& ~, x7 N9 y
  663.   def start; R5 ?3 U+ X$ L* W0 ]6 V8 o/ B
  664.     sion_mouse_start
    / t/ n/ v- J( F
  665.     deactivate
    " W3 b2 l. T( z6 G+ x! f
  666.     extra_start# S% i, B  @4 K$ a+ k; D9 K
  667.   end
    4 h1 l1 I& W% a" E
  668.   #--------------------------------------------------------------------------# \9 r% |" y8 |7 q( Z! X
  669.   # ● 创建新的数值输入窗口
    * P7 n# N. u0 X, H( `
  670.   #--------------------------------------------------------------------------
    # l2 s2 t: `& K
  671.   def create_extra_window$ ~% ]$ b* d3 R& p7 @
  672.     @extra_window = Window_NumberInput_Ex.new* m8 l5 O: E0 u, l. P; F1 z
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2) A5 x' j0 T7 T
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }' ~+ Z+ w% `+ ^; T1 k% k; L
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    ! m6 D& }& S7 v8 H
  676.     @extra_window.close_proc   = Proc.new { close }& q2 z) `5 _! J6 \
  677.     @extra_window.refresh_proc = Proc.new { refresh }( A3 e, g7 K& w* |) `2 [
  678.   end1 X+ z9 h/ ]8 L1 p/ h) p' j3 Q9 Z
  679.   #--------------------------------------------------------------------------
    . \, ]+ a- }/ n2 G* a
  680.   # ● 激活新窗口2 o6 `# k+ k( U* ^: K5 e, C# t3 t
  681.   #--------------------------------------------------------------------------$ ]6 N$ n, s- w; @9 K4 ]6 a
  682.   def extra_start
    ! ]  R: Y: K' N- {
  683.     case $game_message.position* j+ t  n7 L3 u  U
  684.       when 0; @extra_window.y = y + height + 4
    ' h8 s5 S2 j( y; A( {. z2 V
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 85 B- o* N$ |$ }6 J3 m
  686.       when 2; @extra_window.y = y - @extra_window.height - 40 o# ^8 y2 d5 ~
  687.       else  ; @extra_window.y = 8
    ) \5 ~. o6 }! @0 p8 j0 \2 M
  688.     end
    . t0 j3 j2 g  }
  689.     @extra_window.variable_id = $game_message.num_input_variable_id4 X/ D$ A# h% k/ _
  690.     @extra_window.digits_max  = @digits_max4 X# p0 {* w( z) c
  691.     @extra_window.number      = @number
    ! r, O0 {& t- g$ d3 f" A( V3 o6 ?
  692.     @extra_window.open
    7 t7 c" k9 P; \! }
  693.     @extra_window.activate$ t5 j$ n% F) k! u( m5 o
  694.   end
    + {/ D4 P  U- ?
  695.   #--------------------------------------------------------------------------
    6 \0 u+ D# ~9 H5 ]# o
  696.   # ● 更新' y1 Q1 Y7 C5 B
  697.   #--------------------------------------------------------------------------
    ! {/ B  x9 L+ w' k/ S, _& t2 e( q/ _1 N
  698.   def update/ F) ?/ R6 d9 M% X/ x: {
  699.     super
    0 X+ W1 T& D1 t
  700.     @extra_window.update
    / ^. }! y; S; ~6 ?7 j, N
  701.     update_cursor2 g. _) Y4 Y7 {1 E0 ]: _
  702.   end
    1 C# @2 F, ?6 A% z& Q! \( q
  703.   #--------------------------------------------------------------------------
    , @2 G0 ]8 b3 M  d1 ~) C( `! r
  704.   # ● 关闭窗口/ K& r; p: |( Q. W. d: C5 L
  705.   #--------------------------------------------------------------------------
    # u$ ]7 F2 n* D/ A% O% a; v
  706.   def close
    $ s) E8 A* k, E' U2 X7 C! `
  707.     super3 W( K- t4 ~' F/ q
  708.     @extra_window.close/ O8 @: ^# G0 j( I: V6 X
  709.     @extra_window.deactivate0 N8 G" w6 }$ ]' B' a6 S
  710.   end
    ( b. n% l; i& O
  711. end! V, n! j4 ?: T% K9 |  E- J

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

  2225. : C1 s/ q( M$ I
  2226. #==============================================================================
    ' z6 F+ l4 ~# @+ `! r0 N$ `
  2227. # ■ Spriteset_Map7 d$ i: E' U  j; u' X' y1 @
  2228. #------------------------------------------------------------------------------7 }2 V3 \6 U' y1 @2 m$ ~1 J
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    & Y8 }; m: V% T2 ^+ D
  2230. #==============================================================================
    $ r$ E( G& I9 }
  2231. class Spriteset_Map
    6 z- p( T5 a" c: R$ Z
  2232.   #--------------------------------------------------------------------------
    & H2 I9 V: E5 D, W" h# v6 |5 H
  2233.   # ● 生成路径点精灵* d! v, E. n" w8 E: h' O
  2234.   #--------------------------------------------------------------------------; A! B( ^- ^$ \- r9 ^# Q1 }
  2235.   alias sion_mouse_create_characters create_characters% P$ p% G2 a/ l. y5 {) a# E
  2236.   def create_characters
    $ O5 y" w1 [$ ?* C9 e; S1 }8 F
  2237.     sion_mouse_create_characters
    ! H& d4 A# i$ \! b+ i
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    ( k3 J" q0 k( `
  2239.   end
    9 D8 i# W! `/ ~0 _4 z
  2240. end( P- d- j8 T, Z7 d2 F/ a

  2241. - k- ]4 D# b9 h; q+ K7 z5 Z+ l
  2242. #==============================================================================
    0 J  o( K  y/ K% J7 K4 H
  2243. # ■ Scene_Map
    + p  S! \! W* z8 l
  2244. #------------------------------------------------------------------------------6 d) k% C' ?1 |9 J) o3 s$ ~
  2245. #  地图画面
    1 ^0 Q8 i7 q# H1 E  A* y# j
  2246. #==============================================================================3 u, A$ n; }9 e  d8 [8 K2 y
  2247. class Scene_Map  Scene_Base
    7 J- C$ v8 T2 e; L( b  n: i6 j
  2248.   #--------------------------------------------------------------------------4 o) M6 U4 i1 H6 k
  2249.   # ● 画面更新
    / x, ^" Z/ C$ m% b* l
  2250.   #--------------------------------------------------------------------------
    2 F; B; [$ n1 p! V" D6 l
  2251.   alias sion_mouse_update_scene update_scene  V3 l9 P' ^6 q6 R" T
  2252.   def update_scene7 b; W5 k! r( p$ b3 k  R
  2253.     sion_mouse_update_scene6 L8 c& v3 J& \0 {
  2254.     update_mouse_action unless scene_changing; _( k( x7 v( Z' ^* K9 Q8 {4 X) J/ j8 [
  2255.   end
    / H2 f' h+ ^( l4 P/ H2 c. }2 }
  2256.   #--------------------------------------------------------------------------
    8 ~  p$ {% B$ F3 ]* j9 N+ ~
  2257.   # ● 场所移动前的处理1 |1 O  Z$ e6 w( e/ f6 C+ ^$ j6 v
  2258.   #--------------------------------------------------------------------------
    & T2 k* i+ f' h6 g1 i- H( B
  2259.   alias sion_mouse_pre_transfer pre_transfer
    & \1 R0 L# d) Y3 _1 Q8 v
  2260.   def pre_transfer& }/ u5 B/ h; o
  2261.     $game_player.reset_move_path* ], _8 T9 b) w: G& _
  2262.     sion_mouse_pre_transfer
    / Z/ C# K3 j& S* w$ s( ~# E# q; N
  2263.   end
    & }' B4 H1 W. L1 L$ G0 N
  2264.   #--------------------------------------------------------------------------1 z1 x5 }) ~' Y5 o
  2265.   # ● 监听鼠标左键的按下
    - h; q8 A7 D0 p$ J3 f" _
  2266.   #--------------------------------------------------------------------------
    ( a% k! B& }) P5 R4 p
  2267.   def update_mouse_action
    + M+ \- ^/ v- Q9 a/ Y% g5 e
  2268.     $game_player.left_button_action if Mouse.press(0x01)' f7 s$ `; Q5 D- D! M
  2269.   end
    / l: G- w% T1 v) }: P, a4 S
  2270. end
    % c2 B3 U: n6 i
  2271. $ d5 {. d9 U: f3 u
  2272. #==============================================================================2 |( s& H! K, i/ j8 L. I
  2273. # ■ Scene_File
    % j0 ?. l5 N& }7 Y
  2274. #------------------------------------------------------------------------------) A* P7 m( Q1 P
  2275. #  存档画面和读档画面共同的父类
    , d, \: `1 |' e- s& w, \( X
  2276. #==============================================================================
    9 Q) ~& P+ C; h. ]* Q
  2277. class Scene_File  Scene_MenuBase
    / i) N+ t( G  {# j( o- G' T
  2278.   #--------------------------------------------------------------------------# m$ {( l1 Q+ z' q  ^  T0 i
  2279.   # ● 开始处理
    1 I0 F6 E( E1 s0 C7 |8 J
  2280.   #--------------------------------------------------------------------------8 [' o, a2 m3 D. \
  2281.   alias sion_mouse_start start/ j- [7 S  _. _1 y- ~. p; }% t
  2282.   def start! C. s6 H! d3 y2 d. |
  2283.     sion_mouse_start! I% Y9 X6 I  S
  2284.     @move_state = 0
    * s7 ?: U, D( B9 P) U
  2285.     set_mouse_pos
    $ j9 ?. r  D' F. @! y! P2 U
  2286.   end
    , h6 `+ C, q6 W2 p4 E$ C# b
  2287.   #--------------------------------------------------------------------------
    5 p' d  P: j" y% Z4 D1 q# C* a
  2288.   # ● 更新画面, n) f$ _2 P/ w4 t0 C
  2289.   #--------------------------------------------------------------------------* p' p/ n+ |' W) k
  2290.   alias sion_mouse_update update
    ; e# A7 A! K# L' C' h6 v1 x( p4 H
  2291.   def update
    5 m) |. [9 ^& H5 }2 j. P* |
  2292.     sion_mouse_update
    / @5 |4 J% |- Y( v) u/ Q3 @: }5 X
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    9 L& a- W; ?+ ^: j
  2294.   end6 V* J" J: q' o% m
  2295.   #--------------------------------------------------------------------------
    % v; z1 b( w( E& S7 Y3 P) n$ O
  2296.   # ● 更新光标/ {0 \1 x0 d' T
  2297.   #--------------------------------------------------------------------------
    ) g- E8 c8 L+ ~: L! `; B0 G
  2298.   def set_cursor' m  {7 r, D  _) f& p' t: S
  2299.     @move_state += 1+ J+ g# C; v' Q& o- K
  2300.     last_index = @index
    * a9 `3 u2 ], _% o- {+ t; h
  2301.     if mouse_which_window == -2
    7 v: a. W6 q* C) b
  2302.       if (@move_state - 1) % 6 == 0
    8 `8 m0 \* |2 U2 v( ?  u) c
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    # s- _3 u' F* r9 |# F! v
  2304.       end2 b3 l/ m* C. z; u
  2305.     elsif mouse_which_window == -1& G3 x  l& F8 A
  2306.       if (@move_state - 1) % 6 == 0
    ; R9 N) j- e  {1 v! v- A* [
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0) v, {# [( T: G9 M: O% z
  2308.       end" M3 W  r9 b) l
  2309.     else; ~- s- R2 g, I( ^$ R! S$ Y! r% E, W
  2310.       @move_state = 09 ~( \9 o; a$ Q4 u; R1 \# r5 _
  2311.       @index = top_index + mouse_which_window
    3 a6 l  d2 q* U$ t8 K  z
  2312.     end
    2 p" ^' I6 }0 w" b5 Z" t
  2313.     ensure_cursor_visible% |/ ^7 r+ r& a  n( \# A
  2314.     if @index != last_index
    - S& @- h" A; S# C  ~
  2315.       @savefile_windows[last_index].selected = false
    3 M8 L9 t6 I' [9 N" i
  2316.       @savefile_windows[@index].selected = true- @% R2 m6 l* h  M; G) a
  2317.     end8 ]6 `5 J8 b* Q, o' M7 l3 \7 a
  2318.   end2 Y6 g3 c) c. i' ^  B: g9 W
  2319.   #--------------------------------------------------------------------------6 P( N" P) n4 b$ G. C  d
  2320.   # ● 判断鼠标位于哪个窗口0 F1 I4 E. M) h8 s/ }# V
  2321.   #--------------------------------------------------------------------------" S3 ?3 Q) r" d5 p5 L
  2322.   def mouse_which_window
    - U; B# u6 ~, t" [, f/ V/ M
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    1 Z$ N# U& J. X' E0 A9 @. h5 m# y
  2324.     if mouse_y  @help_window.height + 14/ z/ A' W7 q$ Q6 B" R
  2325.       mouse_row = -1
    : y& L5 U2 P& Q" S
  2326.     elsif mouse_y  Graphics.height - 14# _; h8 P3 L2 |4 j" X" I7 T* u
  2327.       mouse_row = -2
    / T' L7 \3 h- v) w
  2328.     else
    7 ]# T9 O8 T8 K: P- R9 ]& Z
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    % d% x8 j1 S0 A* z
  2330.         (Graphics.height - @help_window.height)! p" \8 [5 H. R7 R2 {; O! }7 W/ z" J) a
  2331.     end
      Y0 G1 r( F* ~4 S6 [
  2332.     return mouse_row# q7 j- b! b' a6 }
  2333.   end
    $ Y" p3 T9 g9 n9 N$ Z
  2334.   #--------------------------------------------------------------------------
    6 ~4 J8 Y5 j4 [0 G' N  j5 `+ _7 Q
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置( [1 Y3 e9 R0 z$ `. |
  2336.   #--------------------------------------------------------------------------
    1 I4 }! B3 ^8 Z$ O! @) G3 O
  2337.   def set_mouse_pos( d& ~) K. s# w& f
  2338.     new_x = 404 m; v9 j8 a. Y6 [7 k
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    5 G7 {) P( d7 ~' w2 B9 \! K1 M* R
  2340.     Mouse.set_mouse_pos(new_x, new_y)& }4 |# s- \9 y" w9 R" R5 K
  2341.   end. s: H0 L# D! ]. L
  2342. end
    2 z+ o6 ~2 c: N; L, j& E
  2343. 4 J. ]6 q) k/ c. u+ L- h8 m( F) v
  2344. #==============================================================================
    8 I  s$ o# z  j' g9 n
  2345. # ■ Game_Event
    7 B9 {' n5 y- Q& O9 }! l' T& W! w
  2346. #------------------------------------------------------------------------------
    ' f$ b* `  ~" K& k- P+ s
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    2 K9 k0 n8 K+ J* ~2 c5 }: \" F3 {
  2348. #   在 Game_Map 类的内部使用。
    4 R; F; E4 Y1 b7 Y$ ^- q2 ?
  2349. #==============================================================================
    2 H  ?- P' w$ c- c8 Y
  2350. class Game_Event  Game_Character" N& R+ a* H- h8 z
  2351.   #--------------------------------------------------------------------------/ ?5 H4 m. |& K# G, X
  2352.   # ● 事件启动
    ! M  A; r9 Y8 n7 e8 k
  2353.   #--------------------------------------------------------------------------
    6 @: A% A0 z+ G; [5 A% X( Q
  2354.   alias sion_mouse_start start1 R9 W; c' f3 Y3 b4 W
  2355.   def start4 G! I5 y" j+ d# f2 M5 m0 s
  2356.     return if mouse_start && !Mouse.press(0x01)' T/ n0 S  l/ R3 A* p
  2357.     sion_mouse_start
    ' z2 X) r$ g, p$ E+ G: o- Z4 K
  2358.   end
    ! T( T1 S4 ]- m' v
  2359.   #--------------------------------------------------------------------------
    # y$ ]4 V; d0 E* M* Z2 t4 L( b
  2360.   # ● 判断事件是否由鼠标启动
    4 k+ K+ v0 V9 p! r9 e
  2361.   #--------------------------------------------------------------------------* U9 j# @. |9 V4 u: z  C
  2362.   def mouse_start
    ) }+ ?) C6 g- X) i- p6 `: S: V
  2363.     return false if empty6 ^7 \3 \7 G9 f' C" K
  2364.     @list.each do index
    5 C8 R2 z: @$ A2 a) _6 @
  2365.       return true if (index.code == 108  index.code == 408) &&  x/ }; k' j8 R. @7 T4 F: `
  2366.         index.parameters[0].include('鼠标启动')
      n: `# g+ c  l+ s/ _1 ]
  2367.     end
    . s/ _( ?+ X3 I( p
  2368.     return false" x" y3 m& v- u7 U) M) a" N2 p. \- b
  2369.   end' P0 H* z& j' {# `& l3 J) o5 [
  2370. end
    # K2 o7 d) O$ h& U% D

  2371. 1 L1 V- H  T4 w3 K
  2372. ####泥煤的height
    . S1 ]$ Y$ k) a3 A1 h0 y$ |4 A0 K
  2373. # @height = height
    ' {! l0 A$ |0 P1 W) t

  2374. + A9 H" _5 T& {0 _
  2375. class Area_Response
    . `3 x( z# Z" _: B9 D8 c& g+ W
  2376.   attr_accessor type& V. v& y. ?2 P" S
  2377.   attr_reader ox' Z6 Q; j6 ^7 X; f0 k& r
  2378.   attr_reader oy4 P: J0 H0 I5 ?  r8 y9 V/ E2 J/ q5 `
  2379.   attr_reader width0 A) N' A  g( y& U& m5 n9 O
  2380.   attr_reader height
    7 B+ U* w7 M& A
  2381.   attr_reader switch_id, y3 A7 r6 G8 Q; i6 S
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)  }. V& V, r9 `# |
  2383.     @type = type* s. ], k$ U- c
  2384.     @ox = ox
    0 H+ Z/ N: j. G1 _
  2385.     @oy = oy& l- I0 D9 t# a+ T
  2386.     @width = width
    $ j6 O' V6 `8 y5 G9 ]" U
  2387.     @height = height
    3 Q8 T4 t9 x0 C9 G  E
  2388.     @switch_id = switch_id; K( X1 B! D2 J1 b, y! ?. V
  2389.   end
    9 l( E, `* b6 d  P( E+ j
  2390. end6 C5 K+ K7 V% y' {
  2391. # P0 @# P% [3 I2 @
  2392. $area_responses = []: X7 c% \/ G$ L

  2393. 3 R: c( ^2 t, K
  2394. class Scene_Map. L$ [3 G4 a$ z
  2395.   alias update_mouse_2013421 update_mouse_action
    8 \2 v8 O! Z  L7 I- R; w
  2396.   def update_mouse_action
    8 x) P3 N8 v6 t  C4 ^
  2397.     update_area_response/ p8 g; g1 ?6 F* T+ H0 v) K# a& x
  2398.     update_mouse_2013421# F, P8 ]# G+ ^" [6 V
  2399.   end6 w% I; ]% j* ], r; a% T* A, O
  2400.   def update_area_response
    " o4 n0 I- ^$ K/ c! Z
  2401.     responses = $area_responses  s0 X- }) T$ z3 h' T7 v
  2402.     responses.each {response( G9 l9 K4 L+ `2 F
  2403.       ox = response.ox
    & x. w& g; [8 x8 j
  2404.       oy = response.oy& f; I$ v3 W& c1 `! @* W4 C1 N- a; u
  2405.       width = response.width4 W, B7 e: s- q8 m- x# e+ b
  2406.       height = response.height9 W8 x# r- [2 h# Q: D7 s7 g3 j' l; o
  2407.       switch_id = response.switch_id0 i* I. J$ \# b8 {' o
  2408.       case response.type
    3 R0 S# B* L6 _, r: h7 y8 N* e
  2409.       when 00 f- K1 V" I0 r9 l: F7 M+ [# o8 `
  2410.         if mouse_in_area(ox, oy, width, height)- M' ], T) [  u7 i4 L
  2411.           $game_switches[switch_id] = true
    ! `# D) p) y( j5 n2 o8 {/ d
  2412.           $area_responses.delete(response)
    % E. u$ K" x  d* Z5 q/ u" R
  2413.         end
    , M* W2 c/ q% _. d
  2414.       when 1
      e9 Y. h; [+ V& x+ p
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)& [7 T" T/ j% G& ?9 f" S
  2416.           $game_switches[switch_id] = true
    . q2 }9 s* W4 p
  2417.           $area_responses.delete(response)4 q9 _6 _& V* A2 Y0 R" m
  2418.         end9 {* i$ p# H) p& Y- c
  2419.       when 21 Z) ]+ ^2 T2 @, X  k" E) ?
  2420.         if mouse_in_area(ox, oy, width, height), F0 s# G" I6 W- V, n% r# l7 X" }; D
  2421.           $game_switches[switch_id] = true
    ! O9 U( _$ @  W1 u6 A* I6 a
  2422.         else
    ! q+ S% y! D* M4 C0 s9 r- e0 F
  2423.           $game_switches[switch_id] = false
    % [, r* v" ~2 b/ a) o/ r9 ?! e
  2424.         end
    7 p9 a1 B3 a+ R
  2425.       when 3
    . X. v5 F+ }9 x
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    , U* t' F4 Z7 Q- k
  2427.             (oy - $game_map.display_y)  32, width, height)) C8 [4 `8 M- ]
  2428.           $game_map.events_xy(ox, oy).each {event
    " ^  ^. b  |6 W) _
  2429.           event.start" \0 X2 R& h/ d7 q2 B9 h& W
  2430.           $area_responses.delete(response)- G' ~- S0 k; _+ G
  2431.           return
    * j0 _& L% |2 y
  2432.           } & j1 D/ I; @0 [/ b
  2433.         end
    $ s! G" b+ _* A9 V- R
  2434.       when 4( V* _8 w" ^& D* ~
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    , [. ]$ Z  E  l* S, m7 j
  2436.             (oy - $game_map.display_y)  32, width, height)
    # H, {1 c6 u5 f8 ~! b8 Q
  2437.           $game_map.events_xy(ox, oy).each {event
    % h6 T9 l0 \* n; x8 L
  2438.             event.start
    , U. m; f- F% M$ s$ y
  2439.             return/ b6 x  d. _: K) V/ o* t
  2440.           }
    , f" ~9 F9 g' |5 ]3 j* Z  R
  2441.         end
    2 a: S2 |* Y7 G# Y0 p
  2442.       end
    9 e  f9 U# E- ~4 h- ^* T% t
  2443.     }4 z5 a7 |+ x, k* P1 j" M7 L3 u/ h
  2444.   end9 A: ^( _3 I' P6 X1 K! q+ A' M
  2445.   def mouse_in_area(ox, oy, width, height)
    9 |8 s2 O, E4 M/ t, v
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&4 V; U, ]) N+ g( r6 ?9 m
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height2 g" P% ^0 t. \! A
  2448.   end
    6 W4 C4 W' a! ^0 C8 \% }
  2449. end
    5 D. ]( K- R) G# _
  2450. class Game_Interpreter
    7 r# z' M, k8 x% b+ X
  2451.   def area_response(arg)
    ; R* E! p. f  i# e, W2 h# ?- c0 O
  2452.     $area_responses.push(Area_Response.new(arg))$ \" R' I8 U9 @- Z+ F) C  L
  2453.   end
    * @( k4 \* z& V  z. U+ f" k2 y8 S( P
  2454. end
    7 Q3 X) W8 u7 V" s/ q# h
复制代码

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

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

GMT+8, 2026-7-23 19:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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