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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    # h, |/ G, ~; e9 z8 ~: Y3 x; o5 J

  2. ; z" R. r) h# b5 L% Z! T
  3.   Sion Mouse System v1.3e
    ; j. q& A( x9 Y* T: @+ u7 a6 f
  4.   3 X6 ~% i0 B, Z0 c
  5.   Changlog+ ~. v# t0 S+ |
  6.   
    , C( I4 E6 r* L4 R1 i( x+ Q' P3 L" a
  7.   2013.4.21 v1.3f! C* Z! O2 c/ D/ W1 d5 Z9 r5 O
  8.     & d1 \4 N# T' }$ n8 O# e/ f
  9.     1.3f 卷动地图 bug 修正$ x6 n3 `( k1 ^1 G5 G
  10.    
    5 ^4 `6 ~- d: c' R) X1 {
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口  P0 ^( Q$ W8 a1 \6 c" k$ k
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内5 A! `5 J* R' q/ J* A8 u. Y7 Z
  13.                               Mouse.unlock_mouse_in_screen 解除锁定, t3 O% o4 w( r% h3 l

  14. 3 g$ w" L, l" W$ C  o. e
  15.     1.3f bug修正7 u) \( f) x. B- _3 b0 ^+ I6 u
  16.   ( d7 ]+ I" r& U7 Z, x2 |# E# S
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及1 o4 L! i5 C, D7 z2 z. Q2 x' m
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    * Z/ l- m) h0 k! |3 b

  19. . @: K" Q/ W9 F5 q' o( y
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处/ ]0 _0 \1 c# p; H; m

  21. , p7 y, S7 S8 n% M% p( ~! [
  22.     1.3b 修正一些罕见的bug;; I2 U& }# \- _! o( |2 ~! U. C3 T

  23. 9 w4 b; h, f& o! Q
  24.     1.3a 代码小修改;5 X0 y2 T0 o5 A0 u& Y
  25.           加入了鼠标点击启动事件的功能,
    ; v2 ]9 j9 s! R: V' l; u' l
  26.           在事件中加入“注释”: 鼠标启动  ,
    & A$ R0 o# @- f+ u& W
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。( W3 J3 A, [9 O) M+ O
  28.   $ S6 s1 E4 X! l7 P' d
  29.   2013.2.12 v1.2
    5 L4 d- ^) a) X5 `: U

  30. - B# K$ h6 I  _/ ?1 t' W( k
  31.     寻路逻辑优化;
    " Z* Z: _, O" N3 L8 ]% z6 z
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    - x( U( q5 d6 ~/ i" s4 B
  33.     现在支持用鼠标来操作载具了。
    & q" y& c5 f/ U& N+ [

  34. 2 }$ ~2 h& ?4 n, |' Y$ e
  35.   2013.2.8 v1.16 ^& O  d+ T+ z4 e" ?

  36. - f  z, q1 W  G! W3 n: O
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    4 a; s1 M: m  E' y
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;1 ]; ?- F+ G) e* ~
  39.     移动时,路径指示点的绘制更加稳定;
    " d4 S$ M4 h* Q! i: H9 n4 Z
  40.     现在支持默认存档画面的鼠标操作了。6 d: @$ f( U5 ^2 ^3 V' H) q
  41. ' O8 F/ p2 u. d

  42. ! y- }  f' V# z& g
  43.   OrigenVersion
    0 R; u4 K/ C6 v- [$ s0 k& f5 u
  44.   $ v1 e2 T# U& b
  45.     2013.2.7 v1.0   [- L* N+ Z* C* N

  46. + D2 g4 w7 V- Q- N# x# }
  47.   主要功能) V* R3 b2 T4 F
  48. 9 q  d$ t; S* U4 R( ?
  49.       使用鼠标进行各种操作...
    1 I3 Z$ P7 }9 [2 {! |4 N0 O
  50.       将鼠标锁定在游戏窗口内' V% N# U% T4 @4 F% q; @* B; c0 h
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    : _0 k! X5 c' G6 u: q1 }
  52.       双击鼠标进行冲刺
    8 N! R( t/ R! J' d3 C+ w
  53.       更改地图卷动方式以适应鼠标移动, P. o& k9 ~) _: L7 |
  54.       变量输入框改良
    8 _! l$ D* W# B. {5 C  Q
  55. ) ^+ t) A( L6 p) b
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    - {: J% \% I' Q- \

  57. 7 E0 Z0 [" T- \# P0 v8 a
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹$ ^% r4 u. @6 r5 I8 N4 F
  59. / j, D5 B: L& i6 f
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    7 d! k1 G) O9 a1 e  h
  61. ) j3 z) t3 B& F/ j1 m

  62. 4 e* }0 `7 _1 ]0 ~. \
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    / }' ?5 `) f* @, h( @
  64. 4 n' y) D* i* G  o) b- C

  65. ( z# _2 O, g+ Y
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示% I8 z- U! s1 g
  67. % O: f; F, ~: h; D6 |% Y
  68. #==============================================================================1 j0 m# A% |4 v( Q
  69. # ■ 常数设置
    % Z# a; b+ G4 R( _5 V3 K) _& Y
  70. #==============================================================================7 b+ D& I7 t1 C) ]
  71. module KsOfSion
    . s0 g  L3 g) x+ _6 o+ D4 p) H& J
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false# C5 m' d8 z1 {+ i0 L- p
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑( [' F5 |! x9 X% `3 C
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    * q0 W. m' S$ j9 \6 v
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    " W/ ^% R1 A5 _2 j
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    2 w  _, \# f# C8 U' G" C- k
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧: h! r8 p! b8 k# U! F
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13); q1 \6 L3 c! `! f! b
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键  i# _0 a, x( H' X: X0 _8 S4 A
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)" l& o: X7 {  \
  81. end
    , F3 Q1 K+ c) J$ v

  82. ) Z+ ~* z% T5 u9 n" I
  83. #==============================================================================! h8 I# W9 ?, m
  84. # ■ 用来显示路径点的类
    4 y2 X; @9 ]' r6 n- \1 Q
  85. #==============================================================================+ L" r/ `* E: E; A- g) Q1 T4 l# C* x
  86. class Move_Sign  Game_Character
    ) Z3 M+ Y9 h* a9 ?0 J
  87.   #--------------------------------------------------------------------------
    " J8 h$ f0 A$ H: s) K) r) f
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    1 z1 l- j: r2 ?4 b
  89.   #--------------------------------------------------------------------------6 r6 w- Q+ X; }0 D* }1 u. N
  90.   def init_public_members
    ' F! Z8 v  _& f! _& C4 |/ L/ e# E
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹. x, i2 o- u# I4 H6 L9 W. z! o
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    8 n$ R7 K0 S5 n
  93.     @move_speed      = 5        # ★ 踏步速度' H' U1 F1 I2 Y! Q! p- N. n  H0 F
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)9 \) P' M1 q  ]% h8 L  G
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度" r) x7 S8 a5 N: ~
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)6 P$ `) a" h$ P4 D' c! v5 ?
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列0 g$ N' {7 o) @) M
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)2 r* \! z' p  e2 v$ I4 ^
  99. * {: ^% n6 R( q& ~

  100. 1 W! f+ _6 v4 {2 s4 D
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    $ k0 c4 F4 W' Z5 }

  102. % Q6 m! B0 h- {# s. j. \( P! s
  103. 7 T' ]' h5 e3 ~8 _
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图: A5 O6 O9 K+ {' l$ t1 j8 |
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')7 R3 T5 k; x! ]" A9 Y; `

  106. ; J& ~. W, N+ p
  107.       if $no_arrowpic_warn. e  ]! [9 }* k. A' Y
  108.         MouseShow_Cursor.call(1)
    $ C/ q; ?* r' ^( h& I8 b
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    0 z7 W6 s5 c7 c
  110. 8 k4 |) C( d( G
  111. “路径指示点”将使用游戏自带图片
    4 s1 a6 L# r) f- G# Y" D; P

  112. 1 v5 ]# s/ K) R" J" S
  113. 该提示可以在脚本内关闭')
    ! ]* D" _1 R: b- M; O$ t' n
  114.         MouseShow_Cursor.call(0)9 }5 }: Y* V7 o1 J6 Q
  115.         $no_arrowpic_warn = false% |4 S" T5 r' i& A% ^
  116.       end) Z- q$ L4 ~. S- W; D
  117.       @character_name  = '!Flame'
    ( B6 ^, U1 x2 T. T; N- `8 S% U( k
  118.       @character_index = 6* p8 Q. m, L$ b& ^% g3 J2 l3 C
  119. . T( ]* j! {3 _6 e5 i% L/ e
  120.     end! l+ r  U1 w) {7 g2 O8 c! W8 L
  121.     @direction_fix = false  # 固定朝向. V* z% f& |+ b! {) m6 I5 r4 H
  122.     @move_frequency = 6     # 移动频率5 m# V7 K2 |) C7 X+ r( {
  123.     @walk_anime = true      # 步行动画2 z2 P- ~$ S$ Y3 h, ?$ o
  124.     @pattern = 1            # 图案
    6 D; Q' e- u5 q' v3 w2 V1 M
  125.     @through = true         # 穿透
    . ~7 d1 z% r1 f" T
  126.     @bush_depth = 0         # 草木深度
      |$ I9 X0 o& Z
  127.     @animation_id = 0       # 动画 ID& l- F* e& t+ P9 A- A
  128.     @balloon_id = 0         # 心情 ID. W/ {9 S! T: x8 a+ L. F- @
  129.     @transparent = true     # 透明
    ; ^+ O% G9 q! o
  130.     @id = 0
    " Y0 P8 ^5 W: I. X7 E: I2 U0 s
  131.     @x = 0
    0 T6 b# i8 a2 H8 o; S7 k. `
  132.     @y = 0$ R$ |1 d+ [$ m/ k' b
  133.     @real_x = 03 n) e- f4 v; M6 B
  134.     @real_y = 0
    ( A& k' Y  d; Z2 v' E" Y
  135.     @tile_id = 0
      e4 o) J3 @4 E) m  X0 _
  136.   end
    # S$ d7 l9 }( J# \! i
  137.   #--------------------------------------------------------------------------
    8 M# s8 D+ y) p* s- |$ S$ v
  138.   # ● 定义实例变量4 P6 d& H6 x1 v7 O
  139.   #--------------------------------------------------------------------------
    8 @& ]% f/ ?7 t5 I. b
  140.   attr_accessor direction  g. u- x  Z3 G  y
  141. end! t2 r; S0 b. O- G  U' i, v

  142. " m0 n, k. z! p! A8 h4 n
  143. #==============================================================================
    6 O9 c9 l9 m  ~0 g
  144. # ■ Module Mouse
    * I6 b8 ^1 H: Q6 k% E
  145. #==============================================================================
    9 E: B; f( D, u% o, T: M
  146. module Mouse) ]) x( ~7 R/ P# a6 d2 A' b! o
  147.   #--------------------------------------------------------------------------2 X3 Q' S1 A$ K: t, s1 K& A
  148.   # ● API& @2 R: K4 f) j1 ~' a
  149.   #--------------------------------------------------------------------------
      @" n7 a2 D5 D" T& Q
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')2 Z5 ^9 [- C9 P3 R7 v
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
      n# {6 X9 E% n* ~4 O, J
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l'). L, a3 H2 \9 R1 h6 T
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')+ w6 g3 U- \  [) y! y9 m2 J
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    ( c: v6 F) v7 E
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')/ L% ?# {' q' _- p; r
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')+ l7 f6 p3 E. ?6 f
  157.   Window_Hwnd       = Get_Active_Window.call$ t/ J9 @, i& O

  158. + Y9 y3 A: s* {7 R4 y; p
  159. class  self
    7 h0 \6 }' [& D) _' H- g% L
  160.   #--------------------------------------------------------------------------
    9 M* ~% d4 }+ x, x: g: z
  161.   # ● 初始化
    & Z8 h. ?/ B% X0 y1 U" M
  162.   #--------------------------------------------------------------------------1 \" |! P5 Y: I: p6 t1 E" G
  163.   def init, S1 l3 J$ {  G% B, Z! w3 C9 S7 ?
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    1 r" i3 x! Y6 g% p8 O+ g' C4 s
  165.     @left_state = 0* v, ]& c2 x; k, k
  166.     @right_state = 0
    # k3 G. D: \; G' {- U' a
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    2 N" X# D4 k0 j$ F/ H6 |
  168.     @dk_count = 0 # 用于双击的判定
    7 {! t# E  V, n' T! K
  169.     @clicked = false6 k  ]% U2 G# [9 H* I+ C
  170.     creat_mouse_sprite
    4 o. x# j& p3 Z2 j/ Q
  171.     update
    , d2 ~, L: f$ [) ~  J7 D
  172.   end% @0 S7 {. }6 w) r: U
  173.   #--------------------------------------------------------------------------. h' ]3 y5 p9 l( y- t
  174.   # ● 鼠标指针精灵
    ) h4 N# N- R  z* V% v- D" \
  175.   #--------------------------------------------------------------------------
    9 ]0 a$ g  v4 G+ N* d% p
  176. #~   def creat_mouse_sprite
    ! ^; E( J+ _8 B8 i& ~
  177. #~     
    , l$ s- j9 k% I3 Y( x1 Q+ L
  178. #~       @mouse_sprite = Sprite.new
    * F# y. ~  l5 _) o" o
  179. #~       panda = 2#rand(2)+1
    % P+ Q0 B, s! b* U. I

  180. 6 P; l6 V; N+ H& S2 W2 E3 S( _9 H9 O
  181. #~      if panda = 1
    9 c6 o+ w" _  r# y% N- u& w. `
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    + Z( s8 G. @, C) z( }% O
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')- w  n' h+ h# z5 X+ U
  184. #~        end#with if File.exist
    - g% c* f& `  L9 b3 c% w" \
  185. #~   
    / X) c# E5 Y. D, o! b5 M- Y
  186. #~     else if panda = 2 #with if panda=1
    & l% q" R1 B5 ]6 u
  187. #~      8 E' i! X$ S- m( \' H5 k
  188. #~      if File.exist('GraphicsSystemCursor2.png')4 _; y6 Y# O0 w1 G, S
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')& L- I+ _$ P4 S4 H& f
  190. #~      end#with if File.exist6 x9 c. k9 f+ D( l2 O% j% h" d" S6 A+ e
  191. #~       , Q2 U, s/ G* G4 @$ |! h
  192. #~     else #with if panda=1: V( L) ^  W5 D* h0 T' |. H
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    : ]7 ^$ A! A9 ?1 L
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    8 z  k* K- r4 i' g
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    : P* s) R  M+ F4 A4 u7 r+ d
  196. #~     end#with if panda=10 p3 S" n1 y1 Y6 L0 G8 V& q
  197. #~     1 s1 p5 J$ J$ `
  198. #~     #with def5 C, z4 k" Y4 _( K
  199. #~   end* S2 M/ }) e- }- b+ a8 A% f
  200. def creat_mouse_sprite8 P$ W0 X( [! ]. E4 v; S8 W
  201.     @mouse_sprite = Sprite.new
    ( _* m7 f3 q; J; {" O3 o0 M& x
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    5 L) |& T! |- _% @- |
  203.     @mouse_sprite.z = 9999# |" ?. _5 f5 d! Z0 |8 r- S0 o
  204.     Show_Cursor.call(0)" u: E+ @$ W) Z
  205. end9 y+ J# N0 ^; R- ?( Z- S0 k

  206. $ P% w& {/ _$ r  U
  207.   #--------------------------------------------------------------------------, J6 `$ D) W3 t. S  f; B7 I1 E
  208.   # ● 更新2 O/ t* H9 |- w& `' i
  209.   #--------------------------------------------------------------------------- `* D% O8 E6 l6 E) V+ i1 @( l
  210.   def update
    ; X- _& [$ ~- Z+ ?
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos, x$ {7 u* ~- k
  212.     left_state  = Get_Key_State.call(0x01). l0 Q" ~  M& Q
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    6 o0 p$ l( L/ a, y* W- L0 T
  214.     right_state = Get_Key_State.call(0x02)
    & _8 M+ C/ m# x! g/ P, Z2 \1 m
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    $ @% [9 r* k# X+ E1 |
  216.     update_double_click* S" R' _9 m+ n+ _" Z6 }* f! x/ N
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1' Y; |, v0 p* T% Q! B0 z. U3 F
  218.   end6 B; T' F! a# U
  219.   #--------------------------------------------------------------------------! A2 x& h. S: e
  220.   # ● 获取鼠标坐标
    . j4 ~+ i8 m6 v! x  L$ u
  221.   #--------------------------------------------------------------------------
    ) G1 n  A3 c4 I% D
  222.   def get_mouse_pos
    : i2 Y9 q% I- _; R; ^
  223.     arg = [0, 0].pack('ll')
    2 ?: s8 a  R- B0 @
  224.     Get_Cursor_Pos.call(arg)" c0 D7 T+ ~4 y' z4 q9 U3 ?6 B
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    7 H/ _, D! i$ R5 O' t. Q/ J- O: m
  226.     x, y = arg.unpack('ll')7 f! G2 ~- R0 r+ v' e
  227.     return x, y5 z% d( z) g' v
  228.   end
    : |8 m" I( k( J( @) R" o
  229.   #--------------------------------------------------------------------------
    ! n$ N; D% z; q# f) y0 z
  230.   # ● 将鼠标固定在屏幕内2 m: g, |/ H' Y* r
  231.   #--------------------------------------------------------------------------. x0 D4 `5 [& u
  232.   def lock_mouse_in_screen9 d" y" g* J5 J% f" y
  233.     arg = [0, 0].pack('ll')
    $ k" n, V+ q/ ?# ~, o
  234.     Screen_To_Client.call(Window_Hwnd, arg), b3 r% i' x- o: H
  235.     x, y  = arg.unpack('ll')
    ( G4 b1 |" c! X4 d' ^- q6 e5 M
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))# u6 M: Q9 d: `  M
  237.   end3 u2 p1 `" u9 C  @
  238.   #--------------------------------------------------------------------------, \& {+ o, w* Y; d. @8 s( L
  239.   # ● 解除鼠标固定. N, }. S! t. F  m
  240.   #--------------------------------------------------------------------------  G( k- H& p1 Y; O
  241.   def unlock_mouse_in_screen
    ' ?) I7 n3 m/ A! ~( p
  242.     Clip_Cursor.call(0)
    " ~0 Z2 l1 k8 [% T7 O
  243.   end5 x5 h5 F  R9 m8 v5 u3 Q3 w4 i
  244.   #--------------------------------------------------------------------------& v% f0 m6 @3 c4 X! V% J% z
  245.   # ● 鼠标双击判定+ `2 v' w: C" T- Y0 y  o# l  L
  246.   #--------------------------------------------------------------------------! X+ L6 x" r/ B1 r% W
  247.   def update_double_click
    - B- h: I9 _$ ~1 C
  248.     @clicked = true if @left_state == 1
      e6 A- f1 G; }# N. ]6 b
  249.     if @dk_count  0 && @left_state == 15 R& h: F% P0 N
  250.       @dk_count = 0; @clicked = false* o/ ]) x2 Y5 t7 D  \8 T/ ~9 l
  251.       return @double_click = true+ u3 Y  Q" X% I! j
  252.     elsif @clicked/ K' M9 a1 C6 w7 _* }8 Q, r
  253.       if @dk_count  KsOfSionDbclick_Frame# W( Z3 i7 S' d
  254.         @dk_count += 1
    . E( J2 V" w5 T) M/ T5 T
  255.       else
    $ o* I7 J* }; z0 A+ w6 k" g" m
  256.         @dk_count = 0; @clicked = false
    * J; f3 t& |* d' J" X+ ?* N5 Z/ H2 G  e
  257.       end3 K% Q6 [$ R3 u1 f( g
  258.     end
    ; D0 [+ B: d3 x4 |! ]" ^/ u7 B4 x
  259.     @double_click = false) G9 s8 W8 Y4 `, H! z/ R/ B
  260.   end
    7 J) x2 j" O+ s) I, ]$ g- m- j
  261.   #--------------------------------------------------------------------------0 k5 T5 f$ k5 Z; J& `
  262.   # ● 按键被按下就返回true& z# l) ~8 K7 ]$ b  \4 H) i
  263.   #--------------------------------------------------------------------------& o8 R& B7 E! S, V, G
  264.   def press(button)
    6 O/ Q" T8 w9 u0 n
  265.     case button
    2 d) c" G3 A$ m7 ?3 O
  266.       when 0x01; return !@left_state.zero' c* G! G9 F: l. |
  267.       when 0x02; return !@right_state.zero2 y  y, a; v. ?( h$ Z7 A
  268.     end
    & N3 ~. ~+ G1 O$ o3 S: s
  269.     return false
    * M* a/ j/ }+ S" s9 Z( ~$ k+ g
  270.   end6 {0 B( n8 T" t0 [! q
  271.   #--------------------------------------------------------------------------! s  B7 Y" E8 c
  272.   # ● 按键刚被按下则返回true! {! O1 c2 i0 ~! o) H* U
  273.   #--------------------------------------------------------------------------
    & ^) q& a# D, C& V$ a
  274.   def trigger(button)
    . Y) G, `+ U# c5 l! p! E
  275.     case button! H5 L9 b; x7 E5 w6 x; P
  276.       when 0x01; return @left_state == 1
    ; Q- v% F4 a- Q/ P) g2 t& D; Z9 `
  277.       when 0x02; return @right_state == 1
    ' I, |+ o% ^$ x! x
  278.     end* t6 s+ X* f% B  a: d
  279.     return false- }$ F2 Q1 C7 P6 r* l
  280.   end
    ; q% o3 X; `! |+ [! |* q# X
  281.   #--------------------------------------------------------------------------) V9 M) d, B, Y( C3 K8 b  O
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true$ V, g5 |. N$ S( B$ x; X
  283.   #--------------------------------------------------------------------------
    : p2 O% J) O$ }& h3 d: a, B# l
  284.   def repeat(button)
    8 P1 N* Q; m& r0 I9 k; |; a/ K
  285.     case button5 k7 C: @3 Y0 J( _
  286.       when 0x01; return @left_state == 1 ; Z% }0 N& ]. Y3 ?9 ?: t0 f
  287.         (@left_state  22 && (@left_state % 6).zero)- h. P2 d0 k+ o/ a8 J, e+ l+ V8 b9 M
  288.       when 0x02; return @right_state == 1
    + U8 ^; Y3 l, S. c* S5 k
  289.         (@right_state  22 && (@right_state % 6).zero)3 Z# {7 E7 v* n
  290.     end& C8 V& X. ]* q9 x2 D# z: E: u
  291.     return false
    / P: ?  |/ I0 O  w; g( w
  292.   end
    $ s) T, j. D3 `0 D' d8 c4 Y
  293.   #--------------------------------------------------------------------------
      T8 Q2 l, f1 V- @: D  q+ g( N0 p' ^
  294.   # ● 判断是否双击鼠标8 K" @- i# U9 i% p4 t" |
  295.   #--------------------------------------------------------------------------
    1 o! i4 c# v8 ]$ \9 L
  296.   def double_click  I. ?2 O) @& M0 b. f' ~
  297.     @double_click
    * _) U( d4 Y0 U! D3 e
  298.   end
    ; Z8 Q: w0 g# f9 B& m; P6 ]
  299.   #--------------------------------------------------------------------------3 m- p: T% {$ U
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)* F, D. J( k# Q, m2 A
  301.   #--------------------------------------------------------------------------
    " X2 t5 o$ t0 M$ E; e& O2 h; B
  302.   def click_count# [2 }  _2 k, F0 d
  303.     @ck_count
    9 ~8 d0 U( K1 e" a. q
  304.   end
    3 K* A3 }* |- O) z
  305.   #--------------------------------------------------------------------------
    7 t% G" m$ r5 y
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    ) S9 l8 n. i; \1 {$ g
  307.   #--------------------------------------------------------------------------  h% m5 B9 B! N6 ]) t
  308.   def left_state; w& x, O4 g, E
  309.     @left_state# `& g3 V+ w  g" R
  310.   end$ T  \' r( ?, E' `, r
  311.   #--------------------------------------------------------------------------$ O& x, Q* ?8 X  W- [
  312.   # ● 获取鼠标的x坐标) s: f5 F2 _4 g0 W
  313.   #--------------------------------------------------------------------------
    % H- Q- {8 N, i5 N7 T! |# M  h
  314.   def mouse_x
    8 h+ k. W  T2 l& k
  315.     @mouse_sprite.x
      p! B2 B1 s5 ^, `& n9 u
  316.   end8 F! g5 j3 R; F0 a
  317.   #--------------------------------------------------------------------------" g/ e3 x" w. S2 C
  318.   # ● 获取鼠标的y坐标
    9 X3 Q/ G# ^: M6 k3 V1 B$ i
  319.   #--------------------------------------------------------------------------
    5 O% D9 R2 Z: C
  320.   def mouse_y" q) G" W$ m- ]3 w& i& I- i% ~: j
  321.     @mouse_sprite.y8 R* S+ n* z1 b5 R
  322.   end
    # G4 p9 ^4 I% _( \" t( ~
  323.   #--------------------------------------------------------------------------' c2 O) G; I6 ?
  324.   # ● 设置鼠标坐标! l( f5 n3 z+ q( j! h
  325.   #--------------------------------------------------------------------------6 l8 W3 ~) j, W" o0 ^% \
  326.   def set_mouse_pos(new_x, new_y)" |8 h# _' N" n' D/ I
  327.     arg = [0, 0].pack('ll')- ~" A) O( W1 G2 c. G+ c5 T
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    1 _+ [) A0 j* ]; k: v
  329.     x, y  = arg.unpack('ll')1 @( B2 b8 u- Y& D) D/ I
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    8 H' M; W& F  j
  331.   end, l0 D3 Y) ]+ [/ p/ p% i7 _, U
  332. end #end of class  self 3 `0 n% S8 Y% O$ \

  333. 5 Q7 N9 b6 B8 t6 {1 a, }
  334. end. E  v/ X  K+ [0 N+ O0 v" U) e  Y
  335. 6 n4 W; H+ ]5 s1 w& u5 b
  336. #==============================================================================
      O" P9 x4 O. \2 f; ^& z+ F
  337. # ■ SceneManager1 z) P9 V' A+ F
  338. #==============================================================================- I* k* y# G3 S6 l7 j. z. e4 @
  339. class  SceneManager* h' [2 F: T* h) q# p
  340.   #--------------------------------------------------------------------------
    * ]- N$ O! B2 y- H
  341.   # ● alias: \, k3 p( S+ k* ?
  342.   #--------------------------------------------------------------------------; {! e1 {) t, b. l
  343.   unless self.method_defined(sion_mouse_run)
    : u/ B: g8 X4 y" a8 }7 \* e: S- Y
  344.     alias_method sion_mouse_run, run2 w. K9 n' v( n3 ^
  345.     alias_method sion_mouse_call, call- H! D) _! [1 p$ U/ |% h" w+ P  F
  346.     alias_method sion_mouse_return, return% \1 v" X" J' {. m; n- K. o4 R3 C
  347.   end2 y" k. J7 ~" M' a) v1 R
  348.   #--------------------------------------------------------------------------
    % x4 V# I1 g. T% s' u+ b8 G
  349.   # ● 运行
    5 @7 ~$ b6 I& W2 l
  350.   #--------------------------------------------------------------------------
    7 X# }; e1 O" L% i$ A
  351.   def run/ v8 u" M! X  P& v0 U
  352.     Mouse.init: L  ^- t: q9 L: @
  353.     sion_mouse_run
    - V. f6 H2 b; ^3 R3 z4 O/ }' }+ r6 s
  354.   end
    & _$ F6 J- z. P$ v0 n3 K+ W1 e$ T
  355.   #--------------------------------------------------------------------------
    2 s) X# r: w; d2 h; N. ~' [
  356.   # ● 切换
    - |0 O2 M% }5 p
  357.   #--------------------------------------------------------------------------3 Q( {* H. V6 B2 r' K
  358.   def call(scene_class)
    $ Y* K" l( g( `; P7 R
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    & g2 Z* y: j4 r* q! C  L
  360.     sion_mouse_call(scene_class)
    * }; y8 T) u( ^. T
  361.   end
      o  r+ H: b; f; y7 Y% \% U
  362.   #--------------------------------------------------------------------------+ g3 q+ K. |8 |3 P' B- M& g
  363.   # ● 返回到上一个场景3 N5 J- f1 Z+ ]
  364.   #--------------------------------------------------------------------------
    ) c& m" u1 J% I/ ?( a
  365.   def return
    : C6 f% h% b4 m& K9 c
  366.     sion_mouse_return6 U; b1 E/ z) F- Q# I; m( ~1 ]" n
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&+ z, ~2 k! x6 |
  368.       @scene.instance_of(Scene_Map)+ ~1 R, l6 }% O
  369.   end) S! A2 l3 m4 z! c0 m
  370. end
      M7 P8 R0 g7 Y; L7 I9 {+ \, f
  371. ( T5 }: w) C* ^3 h$ _) }
  372. #==============================================================================, q# }% G! d% ~6 ]* h) m: }
  373. # ■ Module Input! {: o* U0 u( o4 U! R, Y
  374. #==============================================================================
    * p# u1 x! j* f* |
  375. class  Input* v0 l/ I& k1 n& q6 i/ ]
  376.   #--------------------------------------------------------------------------
    7 a2 {; [% H+ E- A9 j
  377.   # ● alias. p6 U7 E& _6 X# ~) A' o
  378.   #--------------------------------------------------------------------------2 _( B# m& H% Z
  379.   unless self.method_defined(sion_mouse_update)6 K9 |& U. e, j% A3 I0 p3 F% V7 F
  380.     alias_method sion_mouse_update,   update" ^8 L8 y% h+ C; z( ?
  381.     alias_method sion_mouse_press,   press
    $ |1 ^& ~% R0 o6 d/ Z
  382.     alias_method sion_mouse_trigger, trigger# }- ?: B. y9 f7 `, P: A% T
  383.     alias_method sion_mouse_repeat,  repeat( j3 V! N  [; z7 U
  384.   end. W5 d. `& H  e9 n9 x5 _
  385.   #--------------------------------------------------------------------------1 ?1 d$ w0 \2 \# Q
  386.   # ● 更新鼠标
    ) W3 b, j0 N7 \/ ^5 t, p
  387.   #--------------------------------------------------------------------------6 ?9 N+ R. Z( f
  388.   def update
    1 F5 K% a; t) |
  389.     Mouse.update
    ( x. U9 L2 O. q3 R. T3 t9 P
  390.     sion_mouse_update+ g& q: f4 X$ T4 C$ ~8 t
  391.   end0 f7 v" }3 Y2 T8 p# \$ l  P# v  i
  392.   #--------------------------------------------------------------------------
    " H7 W( H# z+ d3 l
  393.   # ● 按键被按下就返回true1 `8 ^2 i  a) d0 }/ k7 c
  394.   #--------------------------------------------------------------------------# ^' g. S6 x0 ^$ D% i, l4 ~
  395.   def press(key)
    2 Z& Q/ j- [' y. N0 O+ W
  396.     return true if sion_mouse_press(key)! C1 r- V; R) ^, \6 h! q6 O& x
  397.     return Mouse.press(0x01) if key == C0 \/ Z1 i! \# \# c$ U
  398.     return Mouse.press(0x02) if key == B
    ) ^# j* b' B+ v5 c
  399.     return false4 j6 P, e- F# i2 `, S
  400.   end
    0 B3 ~2 U) n/ z5 U
  401.   #--------------------------------------------------------------------------& I9 a) n& G2 j8 k4 o% Z
  402.   # ● 按键刚被按下则返回true
    0 `3 A4 p: @1 j: w% L8 H" o7 ?
  403.   #--------------------------------------------------------------------------
    + t, W" G% `, c  Q
  404.   def trigger(key)
    $ ~$ d" |% h9 f- _" y$ k
  405.     return true if sion_mouse_trigger(key)) ?7 M1 t$ C& X
  406.     return Mouse.trigger(0x01) if key == C( ]  R! G" ~% Y: E3 u
  407.     return Mouse.trigger(0x02) if key == B7 K9 r, K+ e" k4 v' y$ P
  408.     return false. \2 q* u7 I6 p) G# @
  409.   end
    * u6 |/ |! r2 G7 ?
  410.   #--------------------------------------------------------------------------1 l) E, A; D3 X/ W
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true: [2 A( m8 W7 W
  412.   #--------------------------------------------------------------------------
    " T) v. Q& c) u4 V! ]4 R
  413.   def repeat(key)( D, h, r" L- ~" X/ d7 \
  414.     return true if sion_mouse_repeat(key)
    , w. ]5 B1 A/ O" X5 w
  415.     return Mouse.repeat(0x01) if key == C3 T: B$ [" S5 w) p! L8 \* ^
  416.     return Mouse.repeat(0x02) if key == B
    ' \& n6 ?9 f3 F( L$ p0 Y8 n$ G
  417.     return false
    ! _# J1 ?: m" G, a4 P; T
  418.   end" A9 r% m% L" s8 E# N
  419. end5 L- p% m) f' d. Z) y0 R* O- W
  420. : K9 z# |0 s* L2 I

  421. ' N4 v* O( B. @3 F" }5 v
  422. #==============================================================================5 O- m* Q4 ^  O6 N% ]
  423. # ■ Window_Selectable3 O( A! X+ ]2 @& j
  424. #------------------------------------------------------------------------------
    * @, s8 M  S( c1 m$ ~" h: J7 k- p4 l
  425. #  拥有光标移动、滚动功能的窗口: Z- R6 a' G, x
  426. #==============================================================================# l+ I5 g3 r5 S  x  \; K3 M; B/ _8 z
  427. class Window_Selectable
    6 e8 |- g# k# R6 H( B0 m; p0 Y0 @$ p0 `
  428.   #--------------------------------------------------------------------------
    9 [& L( M* w- p* j
  429.   # ● 初始化5 b4 Q4 D# @- X& G* d
  430.   #--------------------------------------------------------------------------
    3 K3 U8 U" K$ m3 {
  431.   alias sion_mouse_initialize initialize! f1 C' J; @: n
  432.   def initialize(x, y, width, height)& ?. o3 L0 P' P- P7 l! |
  433.     sion_mouse_initialize(x, y, width, height)
    ' ?5 K# O2 w: G3 c  F
  434.     @move_state = 01 U) ?/ S; `! {
  435.   end
    5 r1 K% l1 l2 Z0 r1 b( z
  436.   #--------------------------------------------------------------------------$ w# u: l. j; A" [/ V5 m8 @
  437.   # ● 更新
    6 `. J/ Z% A9 l+ @2 @
  438.   #--------------------------------------------------------------------------* F: b/ P. Y/ {) v, n+ S  I) n
  439.   alias sion_mouse_update update- p1 z# I* p8 `* i; Y
  440.   def update
    7 K5 Q/ J3 J1 W- t+ `
  441.     sion_mouse_update. _2 @( x6 z, @+ e
  442.     update_mouse_cursor
    6 N1 c- M/ E! U( ~$ v8 g4 R, w
  443.   end8 t1 U5 Z/ L9 i8 R4 P
  444.   #--------------------------------------------------------------------------. D: T$ I$ o( \1 j" K' ^* W
  445.   # ● 启动后设置鼠标到index位置
    5 f5 M8 [9 l) H" C" o# V
  446.   #--------------------------------------------------------------------------
    3 p8 G8 p! L* a8 t. h: F2 V
  447.   def activate
    $ O- u2 F6 ^  @# E  [* m
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    6 u' C( D( l2 Q1 t# {* c" l
  449.     super
    ) h2 O. m/ S  F% _0 z( d: I
  450.   end
    , _: k; z- \3 @! _, e" Y# K
  451.   #--------------------------------------------------------------------------, A1 ]/ u3 e; ~8 E
  452.   # ● 更新鼠标和光标的位置
    % K& Y" [6 Z7 N! _. c, p% U& Y' r4 A
  453.   #--------------------------------------------------------------------------- X' C7 O1 J5 e. ?# J
  454.   def update_mouse_cursor
    1 o; {1 i- W3 h
  455.     if active* c3 T. }$ x1 g" b% j4 v
  456.       if @need_set_pos
    1 ~+ `6 ^4 h9 S/ u
  457.         @need_set_pos = nil
    , [6 ]; g% u/ ]& U9 A' w
  458.         set_mouse_pos7 _7 S  w3 f( z  {0 A
  459.       elsif cursor_movable$ O6 y9 n; ?0 c) b. R5 U9 |
  460.         Input.dir4.zero  set_cursor  set_mouse_pos( s) H% h: A) g+ R+ p1 V* w
  461.       end
    3 r; u# e8 u* p6 G+ B; B
  462.     end4 O; G! u  Z7 t4 h# _: c& F5 Q
  463.   end  ]+ C7 z. F: I. s2 b" W) t
  464.   #--------------------------------------------------------------------------$ y  G9 C% X0 A& F2 ~& S
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能  B6 I/ X/ p# T$ `# @1 O; W1 U8 a
  466.   #--------------------------------------------------------------------------1 b: U, _9 q0 P: x6 Z* F  Q
  467.   def set_cursor  D+ l* x2 h' B  x, f$ w. F
  468.     mouse_row, mouse_col = mouse_window_area' A6 e. V" q- S1 d/ M; P
  469.     if    mouse_row == -1$ J+ y0 `+ n* _) H4 D' A: u
  470.       @move_state += 1 if need_scroll& R3 ~7 S& L9 m9 v9 W5 U( W1 @1 d
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand) E& r) A$ Q( Y$ f! n
  472.     elsif mouse_row == -2
    ' J0 w8 g& D! t8 E% H. P
  473.       @move_state += 1 if need_scroll
    5 v7 s: u( a& W1 r! S8 v
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    $ w4 r" B3 {% L$ K" [
  475.     elsif mouse_col == -1
    ' _$ w& b1 d6 F: D
  476.       @move_state += 1 if need_scroll0 R2 w4 f9 @! Q3 ?
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    0 H) p* e. P  u
  478.     elsif mouse_col == -2- x+ W/ M0 i. w9 E' u2 |5 \% N$ O
  479.       @move_state += 1 if need_scroll
    8 |, K7 K0 k7 w( P+ [# @0 G
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand! h. }' l% F; }; J0 C# ^: c& ^$ f2 `% Y, Q
  481.     else
    % `, y% I' E4 _- _; Y" d
  482.       @move_state = 0( z- B( p7 \# M
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col4 y% N; G# L' t
  484.       select(new_index) if new_index  item_max && new_index != @index
    * I# t7 ?) w6 W5 `
  485.     end
    3 l. @9 \- |) h+ j8 X6 \* [
  486.   end
    ' k* u$ V0 h  i% N4 d
  487.   #--------------------------------------------------------------------------9 n, w7 G$ S9 U- l9 w& @
  488.   # ● 判断鼠标位于菜单的第几行、第几列4 M. d6 M9 U6 R/ G
  489.   #--------------------------------------------------------------------------  r* [* s! \9 G4 t
  490.   def mouse_window_area
    - t' }% z8 E1 [, d+ t" ^
  491.     if viewport.nil # necessary!
    ( q$ ~" N# }+ L2 V4 S$ I2 v
  492.       vp_x, vp_y = 0, 0- T$ Q1 F, d3 o5 h
  493.     else. x6 @/ q/ q7 A$ V
  494.       vp_x = viewport.rect.x - viewport.ox' l; S( t) @/ Y4 b: w
  495.       vp_y = viewport.rect.y - viewport.oy
    8 |  g  `: X6 r4 U/ S# k
  496.     end
    : Z! |2 m/ q  h& _
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    % [1 t+ A3 O& A+ O
  498.     item_x1 = vp_x + x + standard_padding
    0 o) m! W2 R  k) }
  499.     item_y1 = vp_y + y + standard_padding) o. d  J2 b; i" s' r
  500.     item_x2 = vp_x + x - standard_padding + width
    , B' }$ M0 ]- f& e/ a
  501.     item_y2 = vp_y + y - standard_padding + height
    9 Y( N! ^- l; ^0 \' H9 |2 V
  502.     if mouse_x  item_x1$ y8 o7 Z* \/ k9 K% F6 ~
  503.       mouse_col = -1
    1 d3 l5 }$ p  v& t
  504.     elsif mouse_x  item_x27 S6 ?  g9 s" j6 f4 e" n3 f
  505.       mouse_col = -22 r9 o" V, y7 y- N0 B' d
  506.     else
    - b6 L3 e" L8 b
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    6 L- }& a) `/ O% }. x$ A# @
  508.     end! B0 I' V" A& I: _4 b3 A1 _
  509.     if mouse_y  item_y1. @2 s4 I8 S1 N) _/ B) M. {7 y+ w
  510.       mouse_row = -1
    ' }3 j+ c0 R0 S" I+ l$ E
  511.     elsif mouse_y  item_y2* m0 t! u1 N; ^7 d
  512.       mouse_row = -2# m% [. M* [2 x; D1 D% ?
  513.     else
    ' X; d3 ?( ?- R( S$ j3 L
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    & Z& W7 T" R, k& x5 R2 E
  515.     end
    ! n2 `% l7 ?# l& w( l
  516.     return mouse_row, mouse_col
    6 |6 _* Z) q: z# Y: S& _8 c
  517.   end3 \4 t* g% q% U# X- F# K9 f: F, T
  518.   #--------------------------------------------------------------------------( u' K) f* _5 ^; E4 [1 v" W( `3 h7 N
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    8 ^1 L. M3 Z0 g- k- w: J
  520.   #--------------------------------------------------------------------------
    3 c$ \: ~0 {+ Z: P0 d
  521.   def set_mouse_pos
    6 g7 H# H4 \: P, ~
  522.     if viewport.nil # necessary!
    # _' j' G% G/ a% E8 D  c! l
  523.       vp_x, vp_y = 0, 0% b8 A3 a' D* U
  524.     else
    : ~' s1 M( V9 k, E* D. E) ~5 e/ Y
  525.       vp_x = viewport.rect.x - viewport.ox
    + v3 w7 ^+ R5 [& `/ o0 `) _
  526.       vp_y = viewport.rect.y - viewport.oy4 A7 t% h/ [# q: a
  527.     end
    # r1 d; e: m  {/ \$ U- A1 u  B
  528.     item_x1 = vp_x + x + standard_padding
    8 c. ~: D4 T1 T. T8 K
  529.     item_y1 = vp_y + y + standard_padding
    9 p2 _2 B# ]0 G. H) q- U5 J
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index * H) @& w! Z9 X, M& @7 F3 X
  531.     row = get_index  col_max - top_row' M6 V+ X- ]! y3 [
  532.     col = get_index % col_max2 `% D# \4 E  n4 q# n; l" o+ J
  533.     new_x = item_x1 + item_width  (col + 0.5)8 ~) e2 L7 B6 |' M% b
  534.     new_y = item_y1 + item_height  (row + 0.5)# \+ O* }& t9 s: v: \8 {
  535.     Mouse.set_mouse_pos(new_x, new_y)
    & \9 o0 X! Z9 R; F% F
  536.   end2 ^4 Y( Q3 j6 d4 }4 F+ a# H
  537.   #--------------------------------------------------------------------------
    ' Q8 N: S& y3 z) N% }2 _8 b" b0 y
  538.   # ● 判断菜单是否需要卷动3 D. ~2 M2 `8 q8 `! O# _
  539.   #--------------------------------------------------------------------------# t; T* k9 |0 d- \/ W
  540.   def need_scroll
    0 f" a0 h( r. m5 m7 T+ ]
  541.     item_max  col_max  page_row_max
    * \' y7 v" t# j% E+ [" G
  542.   end4 m3 u' k# A; d, q5 ?2 L6 f. t
  543.   #--------------------------------------------------------------------------, E1 x- R8 t# Y) B7 f
  544.   # ● 判断是否为水平卷动菜单
    & d& x6 O, u; @1 W" g" \2 ~' f; A; _3 I' `
  545.   #--------------------------------------------------------------------------
    2 Q* O) x2 n5 i. j; K0 S5 P
  546.   def is_horzcommand+ }% z5 ~2 V" U2 Z0 g7 W
  547.     return false
    8 r8 I/ Z3 o  V
  548.   end9 Z* ]* d' A% `0 ?) g
  549. end
    # G3 {& Y( }9 t% B3 e  g! X* M

  550. 7 h. A6 F. l  R0 q; K, h
  551. class Window_HorzCommand
    & F0 ?0 y/ V1 S1 d3 H1 D6 h
  552.   #--------------------------------------------------------------------------2 @5 M& n4 M: L( \/ A
  553.   # ● 判断是否为水平卷动菜单
    3 a; N; Q& M. \4 w
  554.   #--------------------------------------------------------------------------( q6 u6 ~( }( x" F/ {; W  |
  555.   def is_horzcommand( r6 z. j6 R" d# k* F7 {
  556.     return true  Y4 Q0 T* ?2 I, h
  557.   end1 x, l0 i$ \0 p$ r( P" i
  558. end& c0 z5 q! s0 Y& [3 M$ D
  559. * U5 F6 a8 Z) K0 O; A5 P) Y
  560. #==============================================================================% o9 \* p( L7 D: i
  561. # ■ Window_NameInput
    # n/ f7 E/ s3 d% X* s5 z$ y
  562. #------------------------------------------------------------------------------
    2 M6 B8 L: i# t3 T
  563. #  名字输入画面中,选择文字的窗口。
    / S9 V* E( o% b% I. F7 d' o
  564. #==============================================================================
    4 h- }! t" {9 _
  565. class Window_NameInput8 P: ]6 \0 M% m1 Z) n* P) W0 T3 ?
  566.   #--------------------------------------------------------------------------
    * s, Y0 I7 I* R/ P  X3 u8 i, z7 s
  567.   # ● 设置列数
    & n: Z8 T" Y( S6 {3 S% Z
  568.   #--------------------------------------------------------------------------# B6 {1 j* t, F' k- X$ Q
  569.   def col_max
    + T" w2 M2 \: ~4 {  {+ d
  570.     return 10# O4 J. H5 f6 @# R
  571.   end
    ! s# t- C8 N2 w) z
  572.   #--------------------------------------------------------------------------
    8 d! x. {4 V9 g! G3 I. v
  573.   # ● 设置填充的Item个数
    * Z; B& @; L, R/ W/ h- P( H8 W  P: s' ^# j
  574.   #--------------------------------------------------------------------------
    9 w. y  x+ g, L7 O7 `: {$ \7 O0 g5 ^
  575.   def item_max
    9 z* k2 \& a. @; B; Q
  576.     return 906 i5 L. `/ J4 s7 k* l
  577.   end3 U7 Y6 R( q$ O+ Z8 r% `
  578.   #--------------------------------------------------------------------------  B2 p) p* {% n# A" B
  579.   # ● 设置填充的Item个数" I3 q' d7 L4 s+ o
  580.   #--------------------------------------------------------------------------! U  x( c$ p! Y- e' [" X
  581.   def item_width/ P5 ]' n8 k9 m$ Q  s
  582.     return 323 I, f+ e2 n9 x7 `: L
  583.   end) n. y3 ^  Q6 b' W0 p
  584.   #--------------------------------------------------------------------------
    1 \6 x7 y3 t- t+ _% o, p& R
  585.   # ● 判断鼠标位于菜单的第几行、第几列0 z9 D- H8 r4 z4 j7 h
  586.   #--------------------------------------------------------------------------
    8 ~# h* r; |  U! l+ ?" `' U
  587.   def mouse_window_area5 y. _' H% }" S7 I4 Z
  588.     if viewport.nil: P! p: y, ?5 [& d2 q8 e
  589.       vp_x, vp_y = 0, 06 A7 D& S9 J, g  |4 M
  590.     else- h) [, N( L5 H' f5 U2 Y# U7 h
  591.       vp_x = viewport.rect.x - viewport.ox/ @# ?# c8 I; P/ ?
  592.       vp_y = viewport.rect.y - viewport.oy5 x) }7 J  V! A$ F: t0 a
  593.     end
    7 A' [% e9 y$ c/ r; V
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y; k; \% I0 K8 p: K! n
  595.     item_x1 = vp_x + x + standard_padding , H8 |% b% y4 [- p# ^7 O
  596.     item_y1 = vp_y + y + standard_padding. V7 o4 e' a. Y9 k- R0 n. f# [
  597.     item_x2 = vp_x + x - standard_padding + width
    % B3 p" v8 n* k
  598.     item_y2 = vp_y + y - standard_padding + height
    4 m( W3 a7 O6 z2 x  w5 V; ^
  599.     if mouse_x  item_x1+ e5 T! T( ?( e8 e
  600.       mouse_col = -1" {$ I2 Q4 |' t) v: P! P
  601.     elsif mouse_x  item_x2
    ; x; U0 b9 R/ V# ]$ l  Y
  602.       mouse_col = -2! z* Q/ X. A4 \( T7 J5 q
  603.     elsif mouse_x  item_x1 + 1608 J! \" q& \3 @" H& o
  604.       mouse_col = (mouse_x - item_x1)328 w. Z% ~# W$ ^. k
  605.     elsif mouse_x  item_x2 - 160, ~: L/ f: w3 ?3 q
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    2 j* r+ f" P( p0 h; R( b& d4 f
  607.     else( k4 ]; A. v9 ]+ X3 q+ b
  608.       mouse_col = mouse_x  x + width2  5  4+ V2 @7 A- l2 z' E
  609.     end8 A- A! {; b) W9 o1 [: F; x
  610.     if mouse_y  item_y1
    1 `7 p2 W& {  _7 ^
  611.       mouse_row = -1, a/ O8 p* X: O* v( ]
  612.     elsif mouse_y  item_y2/ w) v2 c8 L! I% ~
  613.       mouse_row = -2
    $ U$ N  M, x7 K* O
  614.     else
    - _3 f( `. }" P- q2 |' x- ]
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)" H. ~5 G1 V2 h3 h5 q
  616.     end2 T8 e. y6 ]6 R( V6 @3 e. _" Z
  617.     return mouse_row, mouse_col% _9 v( |$ l; r& q5 f
  618.   end' S' E' N6 b$ f, M* u' O) ~
  619.   #--------------------------------------------------------------------------
    - p$ n7 A% @& Q6 H) b
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置5 S, F& J; C( C( p1 Q
  621.   #--------------------------------------------------------------------------, C, L2 a; {' l
  622.   def set_mouse_pos
    ) e# l$ W, {. `
  623.     if viewport.nil # necessary!9 Z% e0 q& {6 |0 e7 b
  624.       vp_x, vp_y = 0, 0
    / A3 |: M2 x: [9 q; Q# `
  625.     else
    " X. F: T5 u- L' Q& r" w/ M) q
  626.       vp_x = viewport.rect.x - viewport.ox4 @& D/ P; I9 @2 Y6 G5 g/ l" w
  627.       vp_y = viewport.rect.y - viewport.oy
    * `2 H2 e0 N3 w# ~& N
  628.     end9 I/ l  p$ x1 z- a! I( H
  629.     item_x1 = vp_x + x + standard_padding
    7 r( T0 E1 J% T, m1 e( l: ^: S7 Y4 G% L
  630.     item_y1 = vp_y + y + standard_padding
    4 l2 p  a+ p- T" p
  631.     get_index = @index  0  0  @index 2 H2 v5 H7 t3 M! k, Y
  632.     row = get_index  col_max - top_row+ f- q" d  @3 C1 g) v# B8 u( O0 D
  633.     col = get_index % col_max
    , w2 W$ U) U. L& @3 ]: N
  634.     new_x = item_x1 + item_width  (col + 0.5)
    " N, C/ E$ @  l: K  z
  635.     new_y = item_y1 + item_height  (row + 0.5)
    - t9 l8 O% R% b( Z. W0 }6 O
  636.     new_x += 14 if col  4. C1 d: T* n) O, e! _/ L( y! b
  637.     Mouse.set_mouse_pos(new_x, new_y)+ u; u' w! u' v9 v! k# n$ c
  638.   end
      r0 M, ]% |( v. E$ b& i' X
  639. end3 ]9 i) g9 j+ r  k: x+ |

  640. 5 S) t! P( K9 Q* z- F6 y+ t6 b( A
  641. #==============================================================================
    2 Y0 }+ S6 x! N$ n9 g$ K
  642. # ■ Window_NumberInput
    ( n( H$ z7 F4 a- C
  643. #------------------------------------------------------------------------------
    + g. i9 f) M7 T1 N& m
  644. #  重写了数值输入的方法以适应鼠标
    9 {0 Z5 N, u% H; a4 H( G! ~
  645. #==============================================================================
    * ^0 N9 F% V; W) R& x" j3 S
  646. class Window_NumberInput  Window_Base5 m5 `+ _0 j' B$ E8 q! t( a
  647.   #--------------------------------------------------------------------------3 {% v/ v; C( a$ m4 q
  648.   # ● 定义实例变量* w: a* ], x. c7 E
  649.   #--------------------------------------------------------------------------
    * w! g* V8 `+ M
  650.   attr_reader extra_window/ v- A2 L2 j  B+ C" w) E
  651.   #--------------------------------------------------------------------------
    8 }" L4 `- v$ B
  652.   # ● 初始化
    , j2 _* e, P+ j* `
  653.   #--------------------------------------------------------------------------
    . c+ H! G- T5 _; X% H2 ^0 g
  654.   alias sion_mouse_initialize initialize& b. r! C1 R# Y7 F1 t) b) b
  655.   def initialize(arg)
    1 K% q5 F6 o4 S7 J( E& H
  656.     sion_mouse_initialize(arg)% Z# t% `- N' J! Y
  657.     create_extra_window$ M( _' a) _4 l/ J) j% ]% C, X$ v( E
  658.   end
    # O# a3 L  E- A% t9 i% G8 p
  659.   #--------------------------------------------------------------------------# n, O; \% @* L0 n
  660.   # ● 启动
      O3 V( K* q  t
  661.   #--------------------------------------------------------------------------8 _  C5 R  _1 a
  662.   alias sion_mouse_start start, F, W8 A7 M: [9 s% u
  663.   def start
    : _1 c5 r, Y# w2 C% t# v4 u/ i
  664.     sion_mouse_start
      B( Q& h3 n8 P! U% v
  665.     deactivate
    ( i# n4 h# U# Y8 c) N3 l
  666.     extra_start0 K# S2 T  `+ ^& W3 O
  667.   end
    7 }* Y( Y) `! A$ [4 h& Q. v! |
  668.   #--------------------------------------------------------------------------$ q$ Y$ w. @( b4 A0 D$ p$ `  a
  669.   # ● 创建新的数值输入窗口
    " b1 Y/ m9 f6 K
  670.   #--------------------------------------------------------------------------
    2 }. R9 Q: B: y1 P' O
  671.   def create_extra_window
    9 q, Z* _: z. L  B. p" ~
  672.     @extra_window = Window_NumberInput_Ex.new
    1 U! ~2 I- A0 Z+ f& c
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    ! v' N* h' P# K( V" ?2 J
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    3 u' Y' g: F! j$ v
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
      g: A6 d' g* v, K. v: E
  676.     @extra_window.close_proc   = Proc.new { close }2 ?  J! H. F% G) e8 X7 z1 ?6 I
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    - ^) `( j1 p: P  B* E6 i
  678.   end
    1 U0 U6 _0 G! F+ d' `5 c# N" ~: _
  679.   #--------------------------------------------------------------------------$ l" j5 T3 u  H7 ~
  680.   # ● 激活新窗口
    9 c2 P% b/ d' T- U5 V8 N
  681.   #--------------------------------------------------------------------------
    0 A# T* u' n  r! |  p, R! d# ]
  682.   def extra_start
    ) o/ f3 m. @1 n% E: e0 v3 u: f
  683.     case $game_message.position# e+ g9 Y6 A# v, ?. l: d* i
  684.       when 0; @extra_window.y = y + height + 43 ]6 Z4 w# T5 x+ x- s! N
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 88 J8 {) t8 L. h! x! Y
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    8 f  d% a9 U8 \2 p
  687.       else  ; @extra_window.y = 8( [+ n5 Z) s2 Z
  688.     end: I  f6 s( l/ w" K( c" \
  689.     @extra_window.variable_id = $game_message.num_input_variable_id5 }1 m$ ?9 p: Y8 v# [" o
  690.     @extra_window.digits_max  = @digits_max6 T" _- v8 j* y$ @$ z5 S
  691.     @extra_window.number      = @number
    8 R5 S! E; |6 }/ N& r
  692.     @extra_window.open4 V/ y# i9 a% v1 N' R4 S9 v
  693.     @extra_window.activate* _& K/ p: g6 I% _1 s% k
  694.   end' c' b* b! U$ c- s3 K
  695.   #--------------------------------------------------------------------------% G9 T" L2 {) }: |& s- Q
  696.   # ● 更新' z7 c" `  F# q) v5 l; [$ y2 }
  697.   #--------------------------------------------------------------------------2 F3 m, x) r# ?! Z/ \
  698.   def update, V7 W, b8 l$ U3 V$ b0 \
  699.     super
    ; M; s2 D' P, k. J& T7 B" F
  700.     @extra_window.update
    " d9 P) d6 Q3 J
  701.     update_cursor
    $ |; @& B- }/ B' D
  702.   end9 l/ G( D% _& m3 b
  703.   #--------------------------------------------------------------------------9 G( ~( A$ g/ e
  704.   # ● 关闭窗口
    3 p% _/ q3 I# s
  705.   #--------------------------------------------------------------------------
    & ]& \& z! B+ E7 V, K- D* g
  706.   def close
    # L+ ]0 D& g# Y5 n- l- f. d2 B
  707.     super, |; Z" |/ c6 K( c8 P% Z
  708.     @extra_window.close
    9 i% A4 g( F% C! s6 p, A" E
  709.     @extra_window.deactivate
    2 [2 z$ }! d/ P% `
  710.   end
    % B  E: G; W, M- u4 ^9 j
  711. end
    7 W- \* X% ]/ L( q, G6 `

  712. 3 ^4 W* R6 H9 x9 p5 X9 T
  713. #==============================================================================: M  ~3 t# k1 x; C" v
  714. # ■ Window_NumberInput_Ex
    ' Y" h2 f- T& b# m9 G7 P
  715. #------------------------------------------------------------------------------( @! m* V) Q7 Z# m
  716. #  新的数值输入窗口(NewClass). }5 g% C& H& O# d+ n7 V
  717. #==============================================================================! f1 ^% I; F. v0 z. U" `
  718. class Window_NumberInput_Ex  Window_Selectable$ ~  O$ S+ i1 R3 h% S; p- v
  719.   #--------------------------------------------------------------------------
      @, C( H! u( C- {% U: p. e
  720.   # ● 定义实例变量. c9 y( X/ {" E3 X& f' R+ j
  721.   #--------------------------------------------------------------------------3 N9 i5 l+ ?2 @7 U
  722.   attr_accessor number_proc9 W" _  n7 o2 F7 J, ^" _
  723.   attr_accessor index_proc( ~9 z+ a5 o0 I  @
  724.   attr_accessor close_proc
    5 ]- e2 X) V% @  J, f. I+ e
  725.   attr_accessor refresh_proc- I* P7 U  O$ v5 |8 b" [( o
  726.   attr_accessor number, ^( C; G( w; [8 @" X! j
  727.   attr_accessor digits_max
    5 m& r. p$ \: X
  728.   attr_accessor variable_id
    7 V  o4 g0 ?, ?. h3 \/ B, r9 I
  729.   #--------------------------------------------------------------------------* L1 E4 i$ {3 F/ _+ Y
  730.   # ● 数字表5 V+ y  J9 L+ C- L5 ^+ v4 q3 j
  731.   #--------------------------------------------------------------------------
    : {8 q& \1 x  G# |
  732.   TABLE = [  7,  8,  9,  z( i. x8 x! I" B
  733.              4,  5,  6,
      p; @, w, ~7 n
  734.              1,  2,  3,/ b! _7 i1 Q3 ?$ {( P
  735.             '←',0,'确定',]) A0 ~9 z+ ?' @% a
  736.   #--------------------------------------------------------------------------
    ; r/ z6 Y5 O! z9 Q# D# p. V) e
  737.   # ● 初始化对象8 L% l+ D% U! S
  738.   #--------------------------------------------------------------------------
    0 K; b  \* z5 h/ q2 M6 N
  739.   def initialize4 X/ \6 e  m3 B/ b( p% @
  740.     super(0, 0, 120, fitting_height(4))4 o& p" ?2 ^1 Z9 y& \3 P
  741.     self.openness = 0( c0 j5 g; N1 ?, l9 M
  742.     @index = 0
    : e1 l$ n, @* Y% j- I0 p$ y
  743.     @number = 0/ N" _& C4 X7 W5 T% q, ~: p
  744.     @old_window_index = 0
    0 G3 v1 ?/ h. p
  745.     @digits_max = 0, R! j5 s  R8 @, d  L! s
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }; }1 T  x0 i& _& R" i
  747.   end( m  w) E( y" z& b  K+ Q% U1 y2 T6 J
  748.   #--------------------------------------------------------------------------
    ' S" L% ~; v: D3 g% R; U6 g4 [2 G
  749.   # ● 获取项目的绘制矩形5 |3 [% F0 w' m6 r% l9 `
  750.   #--------------------------------------------------------------------------; @( h. [9 f$ j$ k4 m# |/ Z$ L
  751.   def item_rect(index)
    / x  O; a; T/ {  b% l: ?5 q( q
  752.     rect = Rect.new
    7 q- E% G- A% D5 Z+ _
  753.     rect.x = index % 3  32
    ( q! A8 D+ X2 f0 W
  754.     rect.y = index  3  line_height
    7 t) h, ]2 I- ~* t. Z
  755.     rect.width = 32% w  {( Q$ F% L( h
  756.     rect.height = line_height
    1 a$ X- A. ?8 `' c& V9 ^9 M- _
  757.     return rect0 K5 a& {6 u" S5 Q& L
  758.   end/ e" M7 p: Y' P  g, v# X7 _
  759.   #--------------------------------------------------------------------------
    9 E6 U" r9 w/ ]1 D8 R: i
  760.   # ● 将光标设置到鼠标所在的位置( q2 ?. g+ a, \, ^0 k8 _0 W
  761.   #--------------------------------------------------------------------------
    4 J  h- [/ I7 H0 Q3 A. q
  762.   def set_cursor4 e6 ]2 h# t' n  b9 o
  763.     mouse_row, mouse_col = mouse_window_area
    # J6 @9 F: r4 C9 R4 p
  764.     if mouse_row = 0 && mouse_col = 0) ~* L7 g1 N5 ~+ H* _
  765.       new_index = mouse_row  3 + mouse_col" c2 N- d" Z# Y+ ]/ G. O' r
  766.       select(new_index) if new_index = 11
    1 S' O  N$ _5 Z0 ^! V7 E
  767.     end
    ) B) l2 T& t0 ^9 e8 b) \, l: Y
  768.   end- T( H6 r& G  c- Y' S# x
  769.   #--------------------------------------------------------------------------4 K- U/ d7 I5 Q& C9 o/ w
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列5 i8 e% j) D; T  @) b( M$ t
  771.   #--------------------------------------------------------------------------# ^# _/ n2 h- ?% d) U% j
  772.   def mouse_window_area
    ) B" a) Q. K, R' [& r3 W
  773.     if viewport.nil' G7 a: K( c: \! f% g
  774.       vp_x, vp_y = 0, 0
    & W/ z* u; Y3 f! y- l2 D
  775.     else, N4 H8 J2 @9 Y( ^3 A. o& o; R
  776.       vp_x = viewport.rect.x - viewport.ox
    % k) o! O* L1 M& ]7 M6 p) m
  777.       vp_y = viewport.rect.y - viewport.oy
    ! i* P* ?! |% |8 i* I2 U
  778.     end0 O7 X, [" R. O6 j
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y7 {1 S, T- z5 ^
  780.     item_x1 = vp_x + x + standard_padding 4 m3 j) _6 z7 I9 w) o8 h9 r- Z
  781.     item_y1 = vp_y + y + standard_padding
    + o" V4 e  ^" U) ]7 c4 `
  782.     item_x2 = vp_x + x - standard_padding + width
    7 L4 I, ~3 U" W9 o( Y
  783.     item_y2 = vp_y + y - standard_padding + height
    5 N6 @. T2 _5 g* X& v
  784.     if mouse_x  item_x1
    , a1 _* w+ Z2 n) H/ }# t0 l
  785.       mouse_col = -1
    6 _' W* |' w2 e3 ~2 {/ n9 ~  Z5 h
  786.     elsif mouse_x  item_x2
    * a5 k5 D+ h' u
  787.       mouse_col = -26 b" S( {$ _+ v" g/ |6 a+ y, }
  788.     else
    0 k1 [5 `7 G! I# x
  789.       mouse_col = (mouse_x - item_x1)  32
    ! W: E1 ]6 J/ e& ]3 F( d
  790.     end
    : W6 s3 |. p3 ]+ c- p
  791.     if mouse_y  item_y1
    3 _$ Z0 k; u" N
  792.       mouse_row = -1
    % a+ g0 B# k+ A9 B2 R9 O# X
  793.     elsif mouse_y  item_y29 E3 O9 L+ H- E: U- b+ V
  794.       mouse_row = -2
    % ?' {+ ^2 Q9 z* n( [) F, N
  795.     else
    1 b0 u: P4 [' t3 G; h1 j
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    1 p( n6 g4 t- u
  797.     end- G  Q, G( m: m8 M1 \9 X, Z
  798.     return mouse_row, mouse_col
    7 }; R) M: l1 g
  799.   end2 f( F3 h6 }; x0 i, `# M  v
  800.   #--------------------------------------------------------------------------5 L6 D  q  Z: q( Q0 A9 f
  801.   # ● 获取文字
    3 M+ j7 w9 B/ G0 h& U/ \# ]  z
  802.   #--------------------------------------------------------------------------
    8 R$ c1 x. v) b+ O4 j' D
  803.   def get_number
    8 P$ n- b. w! h$ o9 c5 C; J1 z
  804.     return false if @index == 9  @index == 11
    4 _* i' j3 U# ~4 j
  805.     return TABLE[@index]
    3 R, D- N  x  `* g0 q7 o! a
  806.   end7 i' K* I5 h. _6 x4 p0 L
  807.   #--------------------------------------------------------------------------
    2 N" J1 x  A4 s, D5 x/ L* a# k
  808.   # ● 判定光标位置是否在“退格”上
    ; r$ x- B+ P8 o" W9 G2 Q$ g. j5 {
  809.   #--------------------------------------------------------------------------
    : i5 f7 L# k8 n* r# C. e8 D- d
  810.   def is_delete2 h) J2 K2 N% V3 |9 ^( `/ ?
  811.     @index == 9
    ) ~! p3 }+ K; {9 l' h) E/ @
  812.   end
    # |* m( {; p/ b3 W' O) N
  813.   #--------------------------------------------------------------------------
    # Y; `- K& W: @
  814.   # ● 判定光标位置是否在“确定”上
    $ W( y, Y5 x# e' C' M7 W) `5 S
  815.   #--------------------------------------------------------------------------0 y, E$ i, s! V/ Z1 }' i
  816.   def is_ok( s& e; t) U% O3 q+ W0 p
  817.     @index == 11
      U- O. f( e; y
  818.   end6 t3 B1 l  S$ A, Z4 {  b, _" r
  819.   #--------------------------------------------------------------------------
    . a6 D3 j& b( N
  820.   # ● 更新光标" i  Q, e: p9 t, c
  821.   #--------------------------------------------------------------------------. f3 q& z0 [! T) Y: p' D9 q4 M
  822.   def update_cursor, ]" t- b, `+ l+ e/ B3 T/ ]
  823.     cursor_rect.set(item_rect(@index))
    : _9 L" J( p% X3 J) m$ @
  824.   end$ U! m6 b6 g' L/ Q1 z5 q: p
  825.   #--------------------------------------------------------------------------, G- g$ b  F! s3 h6 R
  826.   # ● 判定光标是否可以移动$ v* E, U/ r2 y5 N" q
  827.   #--------------------------------------------------------------------------: l# _' t+ r0 F# V% E# Z6 X
  828.   def cursor_movable7 d- v* c: _7 X. R
  829.     active. P8 p6 w; K+ P6 O8 V8 D8 i4 F
  830.   end( F- _8 C& t, @  D$ u
  831.   #--------------------------------------------------------------------------/ r9 T! u) B  D' L
  832.   # ● 光标向下移动
    4 z8 D& o. C7 Y9 V
  833.   #     wrap  允许循环
    . V+ b( N6 ~% M* y( |/ U0 e
  834.   #--------------------------------------------------------------------------. ^: L& o/ \) r! `8 j
  835.   def cursor_down(wrap)/ ^! O: ^# f6 r! W8 l( K! X
  836.     if @index  9 or wrap! o4 g" Y7 }) C! V) A
  837.       @index = (index + 3) % 125 k4 G9 k; r4 ^+ P9 ]2 ~- l
  838.     end
    ) o. E: }) y' D  u' N4 C( P
  839.   end
    - V% z8 J4 ~7 |$ I
  840.   #--------------------------------------------------------------------------
    3 E% ^0 @& F" `! M) ?5 ?- a% i
  841.   # ● 光标向上移动/ F9 \$ U4 O$ r- Z
  842.   #     wrap  允许循环% T' B) q; ~5 c" y$ L, K8 G3 K
  843.   #--------------------------------------------------------------------------- Z: p( k1 s. f% k" ^& S, P) q
  844.   def cursor_up(wrap)6 O& }& \0 a/ c. Q& \5 v. |6 |
  845.     if @index = 3 or wrap; U; V  s0 O$ n% Z: C- f
  846.       @index = (index + 9) % 12
    : v) G# v; P# |$ J9 B4 d! i
  847.     end
    + W% q# w4 _" N# C
  848.   end
    . `$ K; r+ {( Q/ _
  849.   #--------------------------------------------------------------------------
    + F! c5 p$ f, l1 K
  850.   # ● 光标向右移动4 ^2 v4 b$ Y! j8 Y) `# u  i4 m' o7 b
  851.   #     wrap  允许循环2 B$ Y3 S9 U0 K* r0 I) k+ P4 @+ O
  852.   #--------------------------------------------------------------------------
    - Y8 }: }  U4 X# B& i
  853.   def cursor_right(wrap)
    6 T+ a8 G. Z% s) P8 O
  854.     if @index % 3  2
    9 M/ x6 [/ l2 q% C% w
  855.       @index += 1
    5 ^2 ~$ _4 h# O, }& E/ \
  856.     elsif wrap$ S5 X# |; w7 m: i2 n
  857.       @index -= 2
    ; I* v4 [% E6 G  B1 L7 ^' s
  858.     end. k5 W4 i8 _6 C4 u/ p# J3 U
  859.   end
    " s# S. V! X) Q6 K, ~% T! ~
  860.   #--------------------------------------------------------------------------% f6 H5 B! V; V3 \3 {  y9 U* ]' s: R
  861.   # ● 光标向左移动' X; f, ^) ]# r" @& A4 r! X
  862.   #     wrap  允许循环% U; h. P) |+ R# d5 h$ Y& f
  863.   #--------------------------------------------------------------------------4 w! z- e% k7 x: H0 ]- n
  864.   def cursor_left(wrap)- y8 ?7 }/ P! P( }8 [
  865.     if @index % 3  0
    * M3 q- ^* `' Y2 r
  866.       @index -= 1# A* V! j9 u6 X" c: `
  867.     elsif wrap
    / V$ w6 O" m1 u/ L. R
  868.       @index += 2
    + m6 L7 v# R: q0 z& f
  869.     end0 p- Q2 V' k6 S' r4 t
  870.   end6 q; n" ?' m$ h$ b
  871.   #--------------------------------------------------------------------------; s- T; R7 f4 o! y4 ~  q) d/ t
  872.   # ● 处理光标的移动% b: F4 `' t* c
  873.   #--------------------------------------------------------------------------
    6 m$ `8 N! X. y
  874.   def process_cursor_move
    : m( M" M% `) E6 q- }5 B
  875.     super! T5 s1 O- P2 s
  876.     update_cursor
    8 N* _/ ^4 I' \% |( b0 J
  877.   end6 K6 G' A; i( [- Z! d( `
  878.   #--------------------------------------------------------------------------4 P# I+ i1 @$ D
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    7 A: g  h- K$ }/ N
  880.   #--------------------------------------------------------------------------) j4 d& O: P' w9 j
  881.   def process_handling* o5 _4 g$ ~" {" _% ]  s8 \
  882.     return unless open && active
    * e# o7 Q2 x! W2 C& ~7 g# o6 C' L7 X0 A. [4 j
  883.     process_jump if Input.trigger(A)1 j; `1 U! N2 w" x+ @+ O
  884.     process_back if Input.repeat(B)
    2 V6 B8 z6 D7 v8 G. s7 E+ m" f# l. s
  885.     process_ok   if Input.trigger(C)
    " e# p( \4 H2 q: z8 U6 |
  886.   end1 X( B% j9 U- |5 O5 u$ m: ^' O
  887.   #--------------------------------------------------------------------------, L; ^" N  X7 a0 z" N+ L
  888.   # ● 跳转“确定”) _" R) [! n0 y3 N. M: f& @# A
  889.   #--------------------------------------------------------------------------) F5 ~$ h5 F* h' H6 @+ z0 H
  890.   def process_jump: w: `0 G0 K+ W2 H" y
  891.     if @index != 11
    5 ^) G: I+ y$ d7 N6 x" ]) Z  ?
  892.       @index = 11
    * Y6 I) s1 W1 U* r- N8 p; X+ M% m
  893.       Sound.play_cursor
    / W9 `# Q5 R1 M6 d. R( S- Q+ s' X7 K1 U. K
  894.     end9 a: K* h+ E. X9 d& e- S
  895.   end
    ) U  }6 h7 K* Y' |, M4 j: |& ?
  896.   #--------------------------------------------------------------------------
    + b& u8 k6 Q8 }( j+ @3 }
  897.   # ● 后退一个字符
      i' `5 y  _: f8 z; ]
  898.   #--------------------------------------------------------------------------
    / J0 ~6 }6 _3 O! S$ |& M& v
  899.   def process_back% K% D, X: p0 Y! z  g9 h( f# t
  900.     Sound.play_cancel5 Q8 @! l/ @! Z6 |
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    8 e1 n# n' t* ?* N2 V. [" b
  902.     n = (@number  place) % 10
    3 j& G$ e* S0 A8 b5 I4 N) h5 u2 W
  903.     @number -= n  place8 u2 _! {' G; ~3 X& \! k) ?5 \
  904.     @number_proc.call(@number)
    ( z; c3 `$ }9 w' l
  905.     @old_window_index -= 1 if @old_window_index  0
    . i( `6 P9 e, \- m
  906.     @index_proc.call(@old_window_index)
    9 ^. {1 c) M" {3 ~* [
  907.     @refresh_proc.call
    ) j# m' T6 v1 c' s
  908.   end
    ' Y4 r, ^) x1 b
  909.   #--------------------------------------------------------------------------
    3 ~- I# H" J8 V0 a% `+ j: N
  910.   # ● 按下确定键时的处理
    ! I: T$ r' a- D0 w
  911.   #--------------------------------------------------------------------------
    5 B& l/ M) G& P# J( h- Y: s, ]
  912.   def process_ok
    / f4 \, Y4 M" H
  913.     if get_number
      r  t2 w  u; }
  914.       Sound.play_cursor
    * b' U! s  f( |" ]: T0 h3 g
  915.       place = 10  (@digits_max - 1 - @old_window_index). h* Q& r2 Y+ v( y. K5 x
  916.       n = get_number - (@number  place) % 105 P  g9 I: R% o0 T
  917.       @number += n  place
      O4 T8 T: S8 ^$ V% \( \
  918.       @number_proc.call(@number)
    ) Q  Z/ c) v0 G& W9 S
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 10 J9 C* u8 c7 g. Y/ J: l4 U. _- `
  920.       @index_proc.call(@old_window_index)$ F) M* d& A, p% z9 ]5 a8 c
  921.       @refresh_proc.call& s" Y6 V5 o5 |5 J7 w" P; A
  922.     elsif is_delete
    5 K' F& v) @! P, T/ I6 H! n
  923.       process_back
    - K3 u9 |4 Q& N+ @# z* V
  924.     elsif is_ok$ `( R4 q. O( \* X8 _! H' d
  925.       on_input_ok8 S3 t# p; o; x9 _% B$ R
  926.     end
    ' s- N# O3 U& A& P6 `) J2 m% X
  927.   end
    ' @* U  }2 y. \0 l. ~- u, R
  928.   #--------------------------------------------------------------------------
    ( n6 r3 A! l- R% c. X3 B' O
  929.   # ● 确定1 ?6 s0 V6 j( H" W( g
  930.   #--------------------------------------------------------------------------0 ?$ z4 P+ R7 b, Q
  931.   def on_input_ok
    / M3 u+ o7 x* S
  932.     @index = 0
      Q2 M( ~( `+ m% n& g$ K
  933.     @old_window_index = 0! K8 ]  e( c  V, r
  934.     $game_variables[@variable_id] = @number
    2 Q- Z. g2 K0 L- F5 X- X
  935.     Sound.play_ok
    1 \8 T. P! p0 A$ L. I# w% F% I2 K8 J! y$ s
  936.     @close_proc.call) a5 Y7 ]" X4 {5 v5 v: E, Q9 L
  937.   end) B  K; z7 r2 h# K. L6 G: `. \4 j
  938.   #--------------------------------------------------------------------------; o) b" T- y! P( T
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置- n# m" T6 I  Y+ g0 i$ P- K: b; j0 X( `
  940.   #--------------------------------------------------------------------------
    ! b2 n$ w9 ^( D6 ?/ J
  941.   def set_mouse_pos
    6 @/ N+ G; z' e/ ]* c
  942.     if viewport.nil # necessary!
      W' x5 }8 Q/ c# S( q8 ~/ ~% P0 G
  943.       vp_x, vp_y = 0, 0" h: ~. C" r2 a" E
  944.     else
    3 H, B6 M, t/ C. T* I9 ]$ r4 r( ?
  945.       vp_x = viewport.rect.x - viewport.ox
    - C, ~4 N0 \# A& G/ R( L
  946.       vp_y = viewport.rect.y - viewport.oy6 a% O1 g/ F& d; n
  947.     end
    7 B& j0 g, J- d+ P
  948.     item_x1 = vp_x + x + standard_padding : {4 L0 r3 r$ f% ]
  949.     item_y1 = vp_y + y + standard_padding
    5 v; [3 W) _  ^' h8 p2 f5 E
  950.     get_index = @index  0  0  @index * q! i1 i  K: s5 B) ~. c, @6 d
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5); k- T* ]  \) u/ I
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    3 |) a( k, U  U1 I2 x7 @
  953.     Mouse.set_mouse_pos(new_x, new_y)" k/ R4 d7 m# P1 M$ C
  954.   end- d2 n6 R) l* Y+ [- B: L0 x8 T
  955. end1 j5 b# s0 [( ~8 q, C5 B* ]0 E
  956. 7 e* y. q7 i$ w7 W, o; t5 a4 e/ Q
  957. #==============================================================================3 |4 b9 |! p' \
  958. # ■ Window_Message
    5 p. Y$ {% y7 ~7 F
  959. #------------------------------------------------------------------------------5 O# F/ C8 V( Y8 p# _! E: p
  960. #  显示文字信息的窗口。# Z2 {9 b+ ?7 |" N/ G: `
  961. #==============================================================================
    $ h, j. h9 J! s( b) Y) X: D/ X  x7 h
  962. class Window_Message  Window_Base
    8 B3 y2 C4 x2 `: H( ]! q
  963.   #--------------------------------------------------------------------------
    7 H; X1 `6 G' r; \& P  }& @
  964.   # ● 处理数值的输入(覆盖原方法)" ]/ _6 i6 @, d/ L% D
  965.   #--------------------------------------------------------------------------
    / j* d+ a; Y% Q! g: z) w
  966.   def input_number! H5 N% t; |( p( X. H, k
  967.     @number_window.start% D. c8 _2 m7 J" w" q
  968.     Fiber.yield while @number_window.extra_window.active
    ) x4 o" H/ n, z" K0 s* v
  969.   end; o  D: B, M6 m- E
  970. end+ N0 @: l2 `: I1 e

  971. 5 L) b& C% q. [7 @4 O, l: W6 A
  972. #==============================================================================5 k( p3 _- c5 j1 u( D: s  D+ b# k
  973. # ■ Window_PartyCommand9 d) `3 q6 ?# [) q3 B9 m$ ?
  974. #------------------------------------------------------------------------------
    8 F1 k+ m6 Z4 s6 d8 S4 d7 t( d
  975. #  战斗画面中,选择“战斗/撤退”的窗口。' S* y7 b; y. y" ?/ L: H
  976. #==============================================================================0 J8 t( E, S* T) e
  977. class Window_PartyCommand  Window_Command7 G, x8 K1 ^  ~/ s8 i8 _+ h
  978.   #--------------------------------------------------------------------------
      M+ }1 F4 W6 g* U7 J
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ w. a$ o9 K& f1 Q' F; t0 s
  980.   #--------------------------------------------------------------------------3 b! f/ A' ^3 R. P; {/ V$ j% N
  981.   def set_mouse_pos1 k7 @( K6 P9 d7 y3 [1 ?
  982.     if viewport.nil
    ) `$ j6 _, w  C- [' ~$ m
  983.       vp_x, vp_y = 0, 0) {' p3 O9 K: a" T! e
  984.     else
    & L2 B8 X* C" ?4 G( Y5 p9 l! l
  985.       #vp_x = viewport.rect.x - viewport.ox
    2 F" n9 ?  f7 V! _" r1 F
  986.       vp_y = viewport.rect.y - viewport.oy  m3 ~# t+ t2 l* u& ?1 z, x0 o
  987.     end
    $ d4 ?3 {0 }' q- ]0 d2 @  @/ P5 p' u
  988.     item_x1 = x + standard_padding
    - F" B3 R7 Y& q- y$ p0 }" \" e. d- G
  989.     item_y1 = vp_y + y + standard_padding
    6 d! |& X# Z" U) T* Y' I
  990.     get_index = @index  0  0  @index   _8 b  s- T! b$ `7 ^0 k
  991.     row = get_index  col_max - top_row
    5 ?7 w! v: n/ l" ?9 Q. A) Y: t
  992.     col = get_index % col_max, e" p- d+ \6 w$ ?% @/ o1 ?
  993.     new_x = item_x1 + item_width  (col + 0.5)
    8 Z1 E0 C+ n' ^5 u
  994.     new_y = item_y1 + item_height  (row + 0.5)
    * c% m, A' K5 ^& ~( T
  995.     Mouse.set_mouse_pos(new_x, new_y)
    4 I/ h' y* T; q- ^! o; M3 K/ i+ }
  996.   end. s8 ]2 L( a8 Q" y
  997. end
    - e" o! H  L) _

  998. : S2 q/ x8 z" v
  999. #==============================================================================# m& G4 c( }* V$ s3 Q* J+ X. v
  1000. # ■ Window_ActorCommand
    7 Y; g2 q" j$ Q9 g' S8 C
  1001. #------------------------------------------------------------------------------
    * |4 Q; R- O0 J' U
  1002. #  战斗画面中,选择角色行动的窗口。
    ( R# N9 D) f. R* M0 G+ X
  1003. #==============================================================================
    " ~% W5 w7 B) P2 B# P" N- f
  1004. class Window_ActorCommand  Window_Command- h4 u. n- Y% c! [: |7 f
  1005.   #--------------------------------------------------------------------------
    3 S6 w2 U' A" @5 @  x& @1 O& m
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    / P$ S( U2 t( @0 u5 U/ p  f
  1007.   #--------------------------------------------------------------------------7 ?4 H% K2 i+ _
  1008.   def set_mouse_pos
    6 n7 O9 d6 g: p& I2 E  G
  1009.     if viewport.nil* M  S4 A. E* P, ]" C  i9 T
  1010.       vp_x, vp_y = 0, 0+ v# @; ~5 f! r( u8 s1 ]
  1011.     else
    : Z- }, x' m, s) @5 u8 T9 }! W' _
  1012.       #vp_x = viewport.rect.x - viewport.ox
      o5 o1 F) j- y& r: L
  1013.       vp_y = viewport.rect.y - viewport.oy
    , A( {* n" [* x0 J
  1014.     end
    ' v$ f2 A* I8 {2 ^& I
  1015.     item_x1 = Graphics.width - width + standard_padding  {" l2 f$ E4 @; o4 s
  1016.     item_y1 = vp_y + y + standard_padding7 \9 G- J6 i7 s) a% j! D
  1017.     get_index = @index  0  0  @index 8 C4 ?7 }/ w5 ?; n1 O4 @
  1018.     row = get_index  col_max - top_row
    $ J: c2 r4 G& j" P
  1019.     col = get_index % col_max. Z1 T2 p' L7 p+ w/ h
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    0 o+ k2 L6 \, A- B' f  v! T
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    & z/ W8 V4 b: |  w1 a, u6 i, P
  1022.     Mouse.set_mouse_pos(new_x, new_y)* @. H$ n( U  I; A- u+ u
  1023.   end* |  x6 a# |, i& x
  1024. end
    7 N! |$ P! n0 @0 v% ?

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

  2145. 0 M3 t9 H6 d- w  y) A$ j
  2146. #==============================================================================
    $ }- H" j  W/ u  ?( w/ f
  2147. # ■ Game_Map
    & ]" Y' s( G5 I# b0 D. ~. j
  2148. #------------------------------------------------------------------------------
    4 C0 {9 A8 g3 R! V7 _
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。+ @+ \) m- ?. J% s4 g
  2150. #   本类的实例请参考 $game_map 。/ x/ d( w: A5 ?& {1 v( c
  2151. #==============================================================================
    . |0 j% c& A. M8 ^) v# v6 J
  2152. class Game_Map
    ; C7 W9 x( t0 T
  2153.   #--------------------------------------------------------------------------
    ; I3 \  y  z0 ^3 R0 J. a
  2154.   # ● 定义实例变量
    4 }# K- M; f  i$ |8 D1 I
  2155.   #--------------------------------------------------------------------------
    9 a; V0 g& }+ m* D* I' `0 q
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据, E4 `! s+ @- K# _/ r5 b' `
  2157.   attr_reader mouse_map_y # 同上1 f$ v# F" o" j3 T6 A+ i! U' L3 g
  2158.   #--------------------------------------------------------------------------! m. e: v' X* G0 `
  2159.   # ● 初始化对象! T. P7 p& Y6 \' \
  2160.   #--------------------------------------------------------------------------7 \9 c2 n7 E$ R% n6 F: `
  2161.   alias sion_mouse_initialize initialize
    # a; ~1 Z" _4 O5 i
  2162.   def initialize
    . U) [" o5 ^1 @
  2163.     sion_mouse_initialize- O( F9 j! H% l7 q  J
  2164.     creat_move_sign  ###
    ) \$ v! l- q2 Z9 B, I
  2165.     set_constants% `5 e; g5 m/ h; u! |
  2166.   end
    6 o2 |% |! `# k  f! O1 p; \8 h
  2167.   #--------------------------------------------------------------------------
    $ V% T8 F: e( Y& }1 C  ?& j
  2168.   # ● 更新画面
    * S1 M% D/ d; i7 X3 ?" v) C+ C5 w
  2169.   #     main  事件解释器更新的标志' A& |: ]9 V4 T3 J7 S1 B
  2170.   #--------------------------------------------------------------------------) K' n& M/ D( C$ ?" J
  2171.   alias sion_mouse_update update1 R$ D$ q2 R; |* Z" |
  2172.   def update(main = false)
    # f" g, |$ ^+ a
  2173.     sion_mouse_update(main)) l  ~3 O1 |- Q+ N
  2174.     update_move_sign' Y. r/ J* C; [- O! |* f! {
  2175.   end) g4 v: _( M  K9 A( L/ G* ^2 [9 |; Z5 V
  2176.   #--------------------------------------------------------------------------- S2 d4 a. w: i7 X5 i
  2177.   # ● 创建显示路径点的事件: A# ~4 m+ }; x8 k  \
  2178.   #--------------------------------------------------------------------------/ C" F# G; L' b( K; q
  2179.   def creat_move_sign
    ; N. T  b2 W: s, _, x9 i
  2180.     $mouse_move_sign = Move_Sign.new- q) K0 K' ?6 U4 K* |7 _! l: {
  2181.   end+ X5 {2 k. B/ R
  2182.   #--------------------------------------------------------------------------
    + r5 I4 Z3 W$ H+ r, \- ^
  2183.   # ● 更新显示路径点的事件1 E9 R* W, @1 h& H& I6 O& c) c
  2184.   #--------------------------------------------------------------------------
    5 R0 n& T7 A1 t! F- }
  2185.   def set_constants; s! g7 d2 s8 k1 ~
  2186.     @mouse_pos_setted = true* Q, m, _: r& F# p! ~
  2187.     @set_pos_prepared = false" ?" V$ W4 n, q( W3 ?
  2188.     @mouse_old_x = 0
    ; Y% r+ H0 g3 d/ N2 X
  2189.     @mouse_old_y = 09 z9 ?$ d: u8 j& h' d1 E5 |4 }9 V8 Z
  2190.   end4 z9 T) y3 `. r9 J6 }0 X  @7 |2 C
  2191.   #--------------------------------------------------------------------------
    + ~& k- w# s7 V6 t5 I" E
  2192.   # ● 更新显示路径点的事件
    4 W; n2 t& D/ ~6 M$ x6 M2 S6 Q
  2193.   #--------------------------------------------------------------------------) q$ }+ _% Z% n+ C
  2194.   def update_move_sign$ R2 g9 [5 `+ Z" H" d1 ~. w
  2195.     $mouse_move_sign.update0 m0 Z5 j: M- t$ P  z1 |! Z" Y/ b
  2196.   end
    & Z' J) w7 J" h/ f4 B
  2197.   #--------------------------------------------------------------------------* X7 b: t, w* L; e
  2198.   # ● 获取鼠标位于的地图块的x、y坐标4 [6 _/ b6 y6 _' X
  2199.   #--------------------------------------------------------------------------; t% t+ U7 y7 N) L4 k7 ]
  2200.   def get_mouse_map_xy( h9 J3 s; ^8 K7 u% I- j$ \
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y4 X. X9 ^, a1 C/ ~' d3 z
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    3 {" `/ _3 S9 g7 I# u1 R
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)+ ?/ A4 w# T/ B2 K: n
  2204.   end6 O; u, b/ e' a. a
  2205.   #--------------------------------------------------------------------------
    * I) v5 s# @% q- I
  2206.   # ● 返回地图画面时重设鼠标坐标
    2 x) C- P$ U( S4 G, |$ L
  2207.   #--------------------------------------------------------------------------! f! W: q6 J  a3 o: q) t4 B
  2208.   def reset_mouse_pos
    " ]$ J6 m: {) [* H5 i, X
  2209.     return if @mouse_pos_setted2 S& X( w+ X. Q
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    $ q) }6 e0 \) M2 |
  2211.     @mouse_pos_setted = true9 |/ ?* U8 g) D6 }. N
  2212.     @set_pos_prepared = false' P; o5 V" Y, m! H6 M
  2213.   end8 w) ]: Q; p/ n; c0 n" {8 T; D
  2214.   #--------------------------------------------------------------------------9 F  T+ x: Q( V& R; ?
  2215.   # ● 重设鼠标的坐标# _6 @  P# @& B. S1 K; K9 Y: v( v0 q' |! N
  2216.   #--------------------------------------------------------------------------3 P  K- J! s% H5 t
  2217.   def prepare_reset_mouse_pos
    6 l; A) H& y  u; _' Y% S& Q* w
  2218.     return if @set_pos_prepared+ Y+ B. g+ V& q. k
  2219.     @mouse_pos_setted = false
    & ~' L) y5 f6 |" R  j! D; F  K' w
  2220.     @mouse_old_x = Mouse.mouse_x8 }0 N% z7 w% }) x: S: h  u
  2221.     @mouse_old_y = Mouse.mouse_y
    5 g+ e8 ]1 ]5 q+ C
  2222.     @set_pos_prepared = true0 p2 d% i1 s% ^* v5 J* S  ?# O" u
  2223.   end
    , ?' H) A9 F1 ^
  2224. end
    8 T8 y+ s; q( e. o) C

  2225. ) W# `/ a+ u- @) o9 Q; o
  2226. #==============================================================================
    9 y2 N6 `/ g* U6 l3 e) X6 `
  2227. # ■ Spriteset_Map
    * Y& K0 V, [& l8 k5 p1 Z% Y8 {" I
  2228. #------------------------------------------------------------------------------
    8 p5 U8 P0 L+ i" q3 ^4 D7 {
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。' l6 d4 H, k7 j9 c8 j+ ^
  2230. #==============================================================================6 C; r1 e- p- d. Z! @8 ?$ }6 l0 ^* Z
  2231. class Spriteset_Map2 Q3 Z0 J1 K& g3 b
  2232.   #--------------------------------------------------------------------------" Z/ n: _/ j4 M" a( l
  2233.   # ● 生成路径点精灵
    ' S. K* `% D  Z; V4 w
  2234.   #--------------------------------------------------------------------------! p* _2 v, l  H' i
  2235.   alias sion_mouse_create_characters create_characters
    ) o5 x! t) B8 G2 q. t
  2236.   def create_characters: e1 \3 }+ X# h! m8 F) _  S% K
  2237.     sion_mouse_create_characters# X) f0 V) F1 i$ k2 ^/ N. e
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    $ M. _: y8 `, q3 r9 N, E
  2239.   end) e1 a" B4 U( A+ W
  2240. end
    , C% f/ Q' u% `' V, s) ^7 p1 t
  2241. 9 p1 S. G- e' ]  ]
  2242. #==============================================================================0 V0 C1 b" ?# X+ H/ E3 a* A5 o
  2243. # ■ Scene_Map
    $ v% ?. d) ]0 \. i% M* K; v
  2244. #------------------------------------------------------------------------------
    2 p8 E, S$ @5 [9 l
  2245. #  地图画面" M" I7 s+ I4 w1 l7 A: q9 }- Q
  2246. #==============================================================================* V5 Z. f. @) P* s9 f& t; M/ o
  2247. class Scene_Map  Scene_Base* E$ l1 N8 O! ~5 M
  2248.   #--------------------------------------------------------------------------6 W8 {9 J8 Z' e# `7 S
  2249.   # ● 画面更新! h) i* G& C1 I7 f+ Y* M
  2250.   #--------------------------------------------------------------------------
    7 i$ g" I6 g* c0 j
  2251.   alias sion_mouse_update_scene update_scene
    : V% F- h2 u/ ~) h6 j: J
  2252.   def update_scene
    , y8 ]2 g* |0 G+ h( x% K& Q4 ^
  2253.     sion_mouse_update_scene
    ( g+ T$ B' e- H% I0 _* x
  2254.     update_mouse_action unless scene_changing* L* M" ]: M' _* a1 l8 m
  2255.   end4 ~7 h% F+ d, m) @8 _( d' M9 e
  2256.   #--------------------------------------------------------------------------# s3 d& e1 v+ Q
  2257.   # ● 场所移动前的处理
    ; V; ~# x$ t* |; Y1 e6 P# e2 {) F
  2258.   #--------------------------------------------------------------------------' \: S. ]7 J4 k% n+ Z  g
  2259.   alias sion_mouse_pre_transfer pre_transfer' ]" b( ]; G" U' ]/ n4 T( F
  2260.   def pre_transfer
    9 I* ]& c- I! C
  2261.     $game_player.reset_move_path
    ' M1 O9 |- f+ d3 s3 f' r- F
  2262.     sion_mouse_pre_transfer3 N4 Q$ [6 e" y" W
  2263.   end
    2 @5 w7 b+ i! H
  2264.   #--------------------------------------------------------------------------
    " Q6 @. e1 A, K) q6 x& @
  2265.   # ● 监听鼠标左键的按下$ r# b, R. r/ w# U1 j' N6 X3 a
  2266.   #--------------------------------------------------------------------------
    . t# i, o4 U* A; w
  2267.   def update_mouse_action
    ' }: g8 O6 a+ \/ {6 \9 c
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    * M! @8 {; }) c. u% c3 c6 o9 g8 K
  2269.   end5 ^8 @8 J# O& ]' ~6 s, ~
  2270. end
      {" \1 k; q" \

  2271. 2 |2 q# w8 C( F: N2 T1 j* {" \! T' M7 l
  2272. #==============================================================================
    " W$ L6 {4 w/ ]. z1 [# u
  2273. # ■ Scene_File
    - W$ H  d' ~; F3 k+ i$ g, A* @
  2274. #------------------------------------------------------------------------------& [, o( {4 U. v: T2 Z) z! `
  2275. #  存档画面和读档画面共同的父类
    ! d6 G( n3 l9 S' {) Q/ j- O2 [
  2276. #==============================================================================) B0 ~% F6 n0 ^7 {) X
  2277. class Scene_File  Scene_MenuBase
    ; _& [; Y8 h; t6 }5 \. q
  2278.   #--------------------------------------------------------------------------
    6 Q; V7 R6 ~, _: f2 U2 C
  2279.   # ● 开始处理0 n, e( f5 \" Z4 C  S1 x- a) {$ M
  2280.   #--------------------------------------------------------------------------, U( @4 u  r/ ]( f6 f
  2281.   alias sion_mouse_start start
    & y( ?6 f# z0 Y8 @5 [1 B+ {
  2282.   def start
    2 [, Z) G& q& o/ F" q* ]$ r3 u! y
  2283.     sion_mouse_start; @' O) q: @. [- N8 _! J4 S
  2284.     @move_state = 0, j9 ?! m- w/ B! Z& z3 @4 ]( |
  2285.     set_mouse_pos
    ; u% v4 q0 O. ]$ w) `2 T
  2286.   end( K# C' E+ j; ?% \' d1 m
  2287.   #--------------------------------------------------------------------------
    9 E1 h4 S/ Z% ]7 O+ p
  2288.   # ● 更新画面
    / d# u8 s  Y, d
  2289.   #--------------------------------------------------------------------------& R# }, l' }7 r
  2290.   alias sion_mouse_update update7 y# Y& j# t9 w
  2291.   def update4 I( x/ D' T" B& Y% x+ X0 u
  2292.     sion_mouse_update
    # d' _& P& O9 R- f, O7 n
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    7 F- D/ W$ N; @3 T  M: m9 x
  2294.   end
    " w$ n; l' d% v% y) J; Z
  2295.   #--------------------------------------------------------------------------
    - g5 y. {2 r1 i9 X; y( {
  2296.   # ● 更新光标9 X" Y1 F* d. H" D6 l
  2297.   #--------------------------------------------------------------------------
    ! X0 v9 O5 w  u" Q5 f
  2298.   def set_cursor
    8 x  Z% E& k5 h
  2299.     @move_state += 1
    0 ^/ \% p" p; q7 }, q6 C
  2300.     last_index = @index2 C/ R0 z8 u6 c
  2301.     if mouse_which_window == -2- h* v8 b$ Y! G( Y4 Z
  2302.       if (@move_state - 1) % 6 == 0) N' B! \( |* W3 r- U% _4 y6 Q5 D
  2303.         @index = (@index + 1) % item_max if @index  item_max - 13 L" y7 ]6 f$ P6 A# m0 ^8 H
  2304.       end
    2 |6 i3 u. F0 x( Q! ^0 A, j1 P. b
  2305.     elsif mouse_which_window == -13 v4 o! E- r& k7 X5 T* s7 t% g& |
  2306.       if (@move_state - 1) % 6 == 0# u8 o# N( I3 l  Z) \; C8 R6 p4 v
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    % F! h  A0 E; M# A2 \: A7 Y4 ^
  2308.       end
    1 |$ Z; l0 p* }# y$ v4 d+ B0 C# _# h, U
  2309.     else3 m' a, ]) c. O5 H$ Q( ~
  2310.       @move_state = 02 @2 s- [0 K  V' C% J
  2311.       @index = top_index + mouse_which_window
    " y+ r1 \1 x3 R: ~  Q8 ^
  2312.     end
    , s- p- \- b" A+ Y
  2313.     ensure_cursor_visible
    2 b2 b- \/ p7 u0 A8 P
  2314.     if @index != last_index* t2 k+ _8 U, d5 |) ^
  2315.       @savefile_windows[last_index].selected = false7 `/ _2 Y5 W' B2 G( b) j7 r7 y( T
  2316.       @savefile_windows[@index].selected = true# ^; x0 l9 J, r( P
  2317.     end9 h* B8 |5 X2 m1 E
  2318.   end5 O+ R' W/ i# U; [
  2319.   #--------------------------------------------------------------------------
    9 Q6 ]0 v9 X3 ~( R- u2 e' l7 u( h' |, H
  2320.   # ● 判断鼠标位于哪个窗口' X. c1 R( i0 S( z9 k" R) I2 c
  2321.   #--------------------------------------------------------------------------
    ) s' D( M" ?! W; T
  2322.   def mouse_which_window
    $ w1 D2 G: n' R0 s) v
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    # ?' G. u' r  i) B" g
  2324.     if mouse_y  @help_window.height + 14( \4 ~3 i3 F6 H2 M& _7 H  O
  2325.       mouse_row = -1
    1 |& M- Z, J$ g6 W
  2326.     elsif mouse_y  Graphics.height - 14
    3 X2 c7 Z  E$ e7 W
  2327.       mouse_row = -2
    5 U6 S3 k- d) q; F7 x2 F
  2328.     else9 G* g; B3 b. f8 L2 P
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    6 k  Q( a$ M+ y1 c
  2330.         (Graphics.height - @help_window.height)
    4 a$ a7 a3 N4 l; J) X
  2331.     end  S9 j) E) l/ ?& O3 K+ s$ W
  2332.     return mouse_row
    0 c! S  l% I1 V% o' ^$ V. w, G- U
  2333.   end
    . s/ W4 G5 c6 s: j
  2334.   #--------------------------------------------------------------------------
    4 @" K/ p3 E6 i; }: P
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置4 l2 g: o& U6 m8 L5 D8 p& m9 N
  2336.   #--------------------------------------------------------------------------
    9 S% @" M3 e8 o; Z
  2337.   def set_mouse_pos
    0 ]" w7 u" v1 ?  V
  2338.     new_x = 40; N" `" Q! S% j2 |8 z# Y
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    8 }* A9 a2 e/ p
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    . G. \. A: _+ E; L
  2341.   end* a+ g: ?6 g7 d: `8 N/ {3 p3 c
  2342. end
    3 E1 u, M4 n/ A4 D4 i0 H' U

  2343. 1 o# N; d9 ]; S. C# ?) H  N0 ~4 d1 E# V
  2344. #==============================================================================* a; G+ i# r5 \5 @
  2345. # ■ Game_Event, r( [8 Q, \! h' G+ p
  2346. #------------------------------------------------------------------------------
    ( j9 q1 W2 Q2 A) A0 Q0 `
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。3 n2 B, I* r1 y0 R
  2348. #   在 Game_Map 类的内部使用。
    ) ^3 V) a& v3 V( [
  2349. #==============================================================================5 I. \5 q; ]  R- d0 s, N. r
  2350. class Game_Event  Game_Character* ~# {$ a- S4 A1 K, y: e
  2351.   #--------------------------------------------------------------------------
    % x2 q/ T+ A' Q- @/ j$ X/ D+ O( [5 K
  2352.   # ● 事件启动$ L' \% g+ L0 D- H2 Y4 C
  2353.   #--------------------------------------------------------------------------# m4 ?# L  }  l1 o* F% i
  2354.   alias sion_mouse_start start
    5 z* \8 D0 Y  R
  2355.   def start  E# t( q: ~; Z2 r
  2356.     return if mouse_start && !Mouse.press(0x01)3 Q6 M: e- Q9 S2 B
  2357.     sion_mouse_start8 Z4 s: Z4 v2 v7 n3 P
  2358.   end
    4 _; O, \+ n: A  {5 t/ T
  2359.   #--------------------------------------------------------------------------$ F* @  c1 t' a& X
  2360.   # ● 判断事件是否由鼠标启动
    6 x" k( G) l9 X& X
  2361.   #--------------------------------------------------------------------------
    ; R9 T" W4 ~0 }9 ~( u  w& E
  2362.   def mouse_start
    % S) ]$ q3 V0 p, T" r; X% a! Y! E
  2363.     return false if empty
    " r4 Y* Q6 T7 Q% m; x; v& g
  2364.     @list.each do index
    1 q0 V: \6 S/ ^
  2365.       return true if (index.code == 108  index.code == 408) &&5 ~5 n5 b% V- Z9 I/ Z
  2366.         index.parameters[0].include('鼠标启动'), q" ]! d1 i* O# H# @$ H
  2367.     end/ g5 [( p3 J* N; d, _
  2368.     return false& m" ~$ W- H9 J" P+ y. T
  2369.   end0 ?" d! H5 B! J7 U/ @
  2370. end# c$ R4 m. e* V2 }% }

  2371. 7 K2 v$ |. t2 t, r/ X
  2372. ####泥煤的height; P6 ?! u+ K7 R$ N0 h. X1 \
  2373. # @height = height
    , j( o* {6 b6 D! d

  2374. : Y- T* {: q4 @
  2375. class Area_Response
    2 J8 C" C. ~' }1 e, g" n
  2376.   attr_accessor type
    * S7 A6 b+ Z0 b" R
  2377.   attr_reader ox9 L1 p& b7 v' k% a
  2378.   attr_reader oy' u9 A( c+ Q/ N* j1 o
  2379.   attr_reader width3 y# L8 M; y$ o; V' @
  2380.   attr_reader height7 v* V; a5 S3 t
  2381.   attr_reader switch_id
    ; O& u( J3 O4 A5 X: }- _
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    . L* W7 ?; @3 L& u
  2383.     @type = type' q3 ^! i% s  h7 ~; B( X0 c7 d: y
  2384.     @ox = ox
    ) Q4 P3 [2 W) @
  2385.     @oy = oy3 ^( T1 G! E) F# C& s+ L+ Q
  2386.     @width = width
    / r+ f2 k. C3 [4 [
  2387.     @height = height
    0 r4 J* Z, |+ `* W5 z0 L
  2388.     @switch_id = switch_id0 [* T5 F1 g, X' Z
  2389.   end+ }: X. q- W0 t7 W* a4 _
  2390. end
    ! t8 N9 m2 l" n. @1 ?6 ?

  2391. ! ~# J* W8 ?% n1 E
  2392. $area_responses = []& s8 m" i7 Y; F% c! L8 b- q

  2393. " J6 R/ c3 |1 Q1 r& b. i; ~- B  ]
  2394. class Scene_Map
    " y1 ]( {1 x8 i1 B, j0 R
  2395.   alias update_mouse_2013421 update_mouse_action
      @; f8 F7 F8 x$ i$ s( @
  2396.   def update_mouse_action& U% A/ w: b9 [1 H7 Q
  2397.     update_area_response3 V9 T. y) F% ]7 {
  2398.     update_mouse_2013421
    5 X5 c0 e9 f) T! H, i) a7 P: O6 O
  2399.   end
    " X) ?3 `0 j; V4 y; Y- X: {) M
  2400.   def update_area_response( r7 W; F% P. y, m
  2401.     responses = $area_responses
    . j, t* N, n: ]- T
  2402.     responses.each {response9 d: f/ j$ R0 d2 o
  2403.       ox = response.ox! G; w/ t7 J) d0 \
  2404.       oy = response.oy
    / I+ D: e: G5 m) N/ h8 `
  2405.       width = response.width
    2 a& `& S' d' b) B; G; h8 z7 E
  2406.       height = response.height6 d8 K+ w/ I8 }+ C. D$ V2 J9 |
  2407.       switch_id = response.switch_id
    $ j" L( F& s, q) `8 d
  2408.       case response.type
    9 j, j8 e" e3 X0 z
  2409.       when 0
    . h, _; k/ b: W% L
  2410.         if mouse_in_area(ox, oy, width, height)
    # S; z# d  O0 M$ ^2 L
  2411.           $game_switches[switch_id] = true; O3 `$ U( e7 T  S7 U( b, h
  2412.           $area_responses.delete(response)
    " |8 @1 S) g) W" \# o2 M
  2413.         end; K5 T' c0 X$ n' \  y" F
  2414.       when 1
    4 `( f4 f* d$ ^% \! a
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)  i5 _- A0 p8 S1 O' j9 k
  2416.           $game_switches[switch_id] = true/ L) r0 e) F, i2 c, r
  2417.           $area_responses.delete(response)
    ! v! o7 t9 a3 ^
  2418.         end
    6 W) U8 h$ o0 l
  2419.       when 23 D( b6 G" H9 {
  2420.         if mouse_in_area(ox, oy, width, height)
    ; s6 V( E# L, E! F. v/ m
  2421.           $game_switches[switch_id] = true  O% e, D* I" V. I
  2422.         else
    : H8 j/ [  b1 y. Q$ |0 p8 t
  2423.           $game_switches[switch_id] = false
    1 X. \+ p) X  \# p! I# A$ I# B
  2424.         end& P$ m' e- h* G+ r
  2425.       when 3
    * ?9 d1 z6 y% a3 k" X0 [
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,, l; d: I9 L: _" c8 n
  2427.             (oy - $game_map.display_y)  32, width, height)/ i; g8 a5 L5 _/ K' W2 [
  2428.           $game_map.events_xy(ox, oy).each {event8 p; H8 E$ g  m3 A2 x7 x$ m
  2429.           event.start
    0 J& ^6 p, C6 e" m& |( \
  2430.           $area_responses.delete(response)
    6 S; W1 }' V( j& |2 F6 X
  2431.           return$ n& ?. T) D# X$ @+ j0 l4 ]5 E9 z
  2432.           } 4 r5 M  A4 J6 {. Y% _3 _
  2433.         end
    ' Q2 u5 l" t1 g  t1 g
  2434.       when 4
    , `5 g+ Q1 f, d3 D* H$ Y
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,# `$ O* y4 H0 O1 \1 e5 Q
  2436.             (oy - $game_map.display_y)  32, width, height)
    : M9 u  }+ s" Q9 I6 `( Z
  2437.           $game_map.events_xy(ox, oy).each {event2 O% {" w) W2 \1 I
  2438.             event.start
    . w- U' w$ a, ~& N% c
  2439.             return
    " U. T' M, l& a0 c4 @
  2440.           }
    1 u! |9 @0 G& G% d) M! P
  2441.         end
    $ c" h. W$ i4 p. s, I
  2442.       end6 @2 p% M2 t* X0 w1 O6 |4 b4 G
  2443.     }
    ) E! h% g% r" _' Q$ u, G& Y
  2444.   end
    ) g) h1 W4 t7 p+ F/ {) _
  2445.   def mouse_in_area(ox, oy, width, height)
    ! J2 x9 X: a/ ~6 T  {
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&1 y9 \# u; W  j+ f
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    ; |; b, F5 E' R3 n! D* B3 h5 ?
  2448.   end
    2 N. i6 J+ l4 T, T4 t# }0 u5 j2 `
  2449. end
    ( R2 i, Y# x7 ~9 I, Z+ b! r/ Z' C
  2450. class Game_Interpreter
    7 O& z" P1 F" H( Z/ k2 T
  2451.   def area_response(arg)
    % w. Q  _/ e& y- U
  2452.     $area_responses.push(Area_Response.new(arg)): m/ f, m: a! G% r5 l# k4 l, z" O
  2453.   end( A- U! b, v2 O  Y' d
  2454. end
    # p0 |- i, y+ ]9 i. ~
复制代码

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

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

GMT+8, 2026-7-24 09:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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