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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================( j" t+ S8 ?/ ?1 ]+ ~

  2. ' \) N4 X+ m3 W' d
  3.   Sion Mouse System v1.3e
    : P% x! \/ y; ^$ L, w8 K* \0 `9 ~
  4.   " @) B; f- x5 [) L  x) T
  5.   Changlog; L' ~$ e8 m, ]: n- D2 r
  6.   
    ; W* M6 l3 Q6 I) P, k0 K
  7.   2013.4.21 v1.3f6 v/ e: P' U* G! }/ x; Q
  8.     7 W1 v# ~/ e) {: D5 e6 W: L2 ?
  9.     1.3f 卷动地图 bug 修正$ i. o  T6 T9 X$ V# G
  10.       c' N3 H9 y+ t: W
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口$ {  N, Y; ^& n  E( }, [# C% ^
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内  k( D$ `# Q. [) z
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    1 h2 Y' O2 O6 ~5 O  i

  14. 8 V6 E3 c7 V$ V& q
  15.     1.3f bug修正" f* L% m; \: e' H
  16.   6 F. w) Z# w% Y4 k
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    ; D: k- ?/ \  b$ r$ x8 a
  18.           关闭菜单时,鼠标是否移动到原来的位置。# Q. t4 S1 z1 F# u5 E
  19. , b# z4 U/ q3 S+ z! y, V$ A
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    0 l; P( P: g  `& Q- w1 T) ?, r; L( m% Q
  21. 9 W- f1 S% y# J: p7 W
  22.     1.3b 修正一些罕见的bug;! H- T! a0 W) _3 J) U% p4 I: e
  23. 2 M: P" E1 ^* q4 S/ J0 y/ v
  24.     1.3a 代码小修改;
    ) M' B. t& r) f' q
  25.           加入了鼠标点击启动事件的功能,# S2 h' U9 f7 R+ d$ H
  26.           在事件中加入“注释”: 鼠标启动  ,+ x6 `3 o. x" x5 R
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    " a" Q) D! B$ A, @# ^
  28.   
    , C/ Y' y$ G, w* w; g
  29.   2013.2.12 v1.2$ a- @* Q: O, w8 f- Y5 J
  30. 6 U. b5 M1 @$ w  i4 j
  31.     寻路逻辑优化;# M0 r4 {+ O7 s* [; \/ }7 c1 v+ [
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    ; N; F+ M  d$ D4 J6 N' A
  33.     现在支持用鼠标来操作载具了。6 H# e# u' ^# B: @
  34. ! N1 i# R) e5 C5 t( K
  35.   2013.2.8 v1.18 n7 @6 W3 W; u
  36. / L4 D) x& c: d
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    0 ~. Y# k' k) M5 _/ [+ |6 d0 c
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    * V  C( j* d/ G5 ^6 t( e
  39.     移动时,路径指示点的绘制更加稳定;- N0 g3 M6 z3 L5 b( r
  40.     现在支持默认存档画面的鼠标操作了。% g6 C7 {7 w+ }) O% N7 j# j* m

  41. 2 u, s( j4 j5 ]' a- m
  42. - O- @5 H& T/ f% c( ]- y
  43.   OrigenVersion
    ; V$ P0 e* j8 H" d% a8 a
  44.   
    8 {% y4 @- \3 m3 `8 V0 Y
  45.     2013.2.7 v1.0
    ' c  C, j5 X- g! \- P6 u8 E

  46. 6 J9 i& Z) Q( d/ `& n- M2 V
  47.   主要功能
    9 r& q" o$ ?* G& F' J3 [0 ~

  48. 5 ?6 }/ C5 i% {# `. `$ t  U# x) i  j
  49.       使用鼠标进行各种操作...$ A( r% q( i$ J/ N8 T/ e% ~
  50.       将鼠标锁定在游戏窗口内
    - A" C+ O4 M* x! i2 t: R
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    , _) \& d+ @% ]5 Q
  52.       双击鼠标进行冲刺& i* H! c  {* ]! H6 y# Y+ Q; O+ Q. z
  53.       更改地图卷动方式以适应鼠标移动  w* Z% ]" X* ^& |- K
  54.       变量输入框改良
    9 G& P# w! T" t; _0 T
  55. , g) n( n, e4 q! W, _* |6 a
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    $ n3 k& r$ e: i

  57. 0 y- j& n* I  I, ], o4 G
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹  y0 k8 i6 W6 h

  59. # @3 B- i: m5 U
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    ! N& {3 W0 k, u' B4 d# i6 a, K. F2 }

  61. 3 \6 S, X: e# q$ R, y! X

  62. : ^4 y! P: e6 K/ p& j
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★& x1 U: G6 p* G4 w

  64.   _/ h0 K2 a- V! D: f

  65. 3 g. O9 V+ g/ J6 \. g7 i4 _
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    7 X$ m/ W; X* D1 y& B
  67.   B! G. b; X0 o! ^6 R4 r
  68. #==============================================================================
    4 h  e3 z" n1 C, v- d. c6 v; d
  69. # ■ 常数设置 6 v9 R9 r# ~% h: C
  70. #==============================================================================
    : L/ @7 T9 K" [5 h6 R
  71. module KsOfSion; e& l& t7 U' Y# S) F/ Y3 ^
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    : W+ a. k! X+ Z/ g5 r" y, j
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    % O5 A3 d( l* Q4 f4 A6 f4 d
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
      ~7 D) [9 u% s. F% G
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量4 b; ~+ b, m8 n& J% U. d# X
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处" e5 @) z; m4 x$ x+ c
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧6 a/ K! k9 G& n
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    ) W1 {) j6 X/ a" \. ?& g% l# ]
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键4 W, u9 `& Y4 a1 A, u" d8 N
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    ! R7 B* V" E+ P5 f& ~! d1 d
  81. end
    . W  J4 G% Z' A/ @9 d

  82. * D, \" D2 m3 W$ T5 s7 r
  83. #==============================================================================4 b6 ?% _! `( _; I
  84. # ■ 用来显示路径点的类
    $ E5 Z7 F2 d; P/ j) D
  85. #==============================================================================* n( ?7 G# T9 f1 C7 A6 C, l
  86. class Move_Sign  Game_Character5 _# ~, p" D5 f2 ?) h6 l2 V& G
  87.   #--------------------------------------------------------------------------
    - Y8 g8 o. B& w2 |3 B8 N2 F
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    7 C5 S) M: K+ R. E
  89.   #--------------------------------------------------------------------------
    + T9 w8 X5 p$ e8 {: ^+ e8 O, M
  90.   def init_public_members
    ! L" g0 ~( q' s
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    3 N& [8 y! c" {/ c5 z
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
      Z7 R. f* D5 u$ P8 j
  93.     @move_speed      = 5        # ★ 踏步速度/ b( w3 @( R( \! k) e
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    # \, p, C/ Z/ _: g
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度5 c3 j# {* d% y" O+ p: W0 f. k
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    1 J' J. e% e- `" y
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列2 ^* A. Y" V; {% V& _
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    ) W% {- a: C5 n0 T- ]6 J. t

  99. + Q+ v4 S2 S% h$ {

  100. 7 L; x. B& h9 I& `$ M/ w) [
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    8 ~0 O% Q7 f* w1 z& g2 ^- m
  102.   ?) f3 u9 j6 C# R1 [  p5 k

  103. $ k4 I, ]$ U' z# ?! g
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    * v+ {$ M$ J7 C# j) u" Y1 o
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    6 ~6 c) G! H, i' }5 F

  106. 1 b6 G& M4 \! W. i
  107.       if $no_arrowpic_warn8 u: {# g; U; k- n8 P9 \
  108.         MouseShow_Cursor.call(1)0 I# n$ z3 ]  `5 U, x0 ?; S
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    & J0 b5 s: Z; n' d3 [7 d1 [

  110. - |5 c( H" D% Z8 M' |
  111. “路径指示点”将使用游戏自带图片
    . ?  @- s3 I1 H, {* R9 {: e
  112. " e: y7 {3 W, E
  113. 该提示可以在脚本内关闭')+ Q* B4 p3 l% G! t
  114.         MouseShow_Cursor.call(0)
    . z. u. \$ D+ G, i0 Z. r6 |
  115.         $no_arrowpic_warn = false) n2 f- v/ r- ~
  116.       end
    , U4 J* V" k$ x: ^# p( V4 U
  117.       @character_name  = '!Flame'
    $ M4 O" U; j9 X# z& P3 i. C- r
  118.       @character_index = 6
    7 I/ J0 e" f8 N
  119. # |5 ^( z; u/ G) U) U
  120.     end
    . u( A$ d  s4 i  t" E0 X
  121.     @direction_fix = false  # 固定朝向
    4 R3 Y: K  n9 u
  122.     @move_frequency = 6     # 移动频率
    " X- F1 n0 U5 o3 Y! r: C
  123.     @walk_anime = true      # 步行动画0 S5 h( b9 O5 m  n! p9 t) j( D
  124.     @pattern = 1            # 图案
    " R+ v' L0 u, }, \
  125.     @through = true         # 穿透
    3 o9 O$ O3 `! M3 R! ?
  126.     @bush_depth = 0         # 草木深度: P7 ^* X' Y9 d& r6 p1 K7 _
  127.     @animation_id = 0       # 动画 ID
    4 T, I; S' u  z2 B+ g5 s3 d
  128.     @balloon_id = 0         # 心情 ID
    8 u1 C  J1 B3 S7 w
  129.     @transparent = true     # 透明
    - p2 P0 D+ H2 x6 r, N
  130.     @id = 05 T7 Q7 ]$ K3 p% F2 |4 Z. h3 |/ q: f
  131.     @x = 0
    6 ], {  K( [" q5 q/ Z, [9 P) ]  B) E% P6 d
  132.     @y = 0. b. o+ D2 N: [1 n
  133.     @real_x = 0
    6 _1 Z$ }) U2 o, {; ]6 A( s
  134.     @real_y = 0* q5 N9 X+ {! W
  135.     @tile_id = 0- p3 q; |. E$ B- H& E$ n( W' v
  136.   end2 J* `8 m7 n/ x- Q! M! U
  137.   #--------------------------------------------------------------------------8 Y8 U. R$ j9 c7 l6 ?9 N
  138.   # ● 定义实例变量
    2 z, b7 ~# \4 K# b; c6 h' ?
  139.   #--------------------------------------------------------------------------
    : u1 \1 Q  }& X" s1 `
  140.   attr_accessor direction( l! Y. e, T% s, z' Y, R! ?
  141. end
    , F. O  `) K8 V( f. t  t

  142. 0 n& N; d9 W& d9 M( _
  143. #==============================================================================
    . f% y" o' o9 t5 y5 v
  144. # ■ Module Mouse
    - J( D0 v$ ~. I/ s, k5 a3 K
  145. #==============================================================================
    2 S- M. L" m2 y8 ?. P
  146. module Mouse2 i4 V7 U7 R: j. H
  147.   #--------------------------------------------------------------------------
    4 F/ ], {: G; Y7 z. M$ s
  148.   # ● API
    0 v. T- z" w9 ?6 l/ ?
  149.   #--------------------------------------------------------------------------
    : a, a& ^& N" C6 ~1 B
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')9 H+ R- E6 y  u9 ]. z* H2 p
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    7 @5 a7 }# g. X5 h$ X, p8 S
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    * E2 M4 ]7 C% |! R) \. l5 Y" H4 i5 ^: d
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    . g) o4 t9 x" f7 H# x4 ~
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    ) I5 ]7 N" D" x8 ^* u7 ?' c& B
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    - f) \: ^: ~8 }: [" v4 A( D8 j
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')* I5 H( M6 \4 p( C
  157.   Window_Hwnd       = Get_Active_Window.call
    ( l1 ~% D: e" X+ L/ D5 D

  158. 2 F$ z8 F+ F' p/ m5 C- U" m: m! @1 w
  159. class  self/ L# h# J* s) c6 C1 `
  160.   #--------------------------------------------------------------------------
    % i6 c. @' o& n9 B2 \9 n# U
  161.   # ● 初始化
    ; ?4 d' F4 C* U8 }5 ?
  162.   #--------------------------------------------------------------------------7 K+ i) J; v, q$ W2 M& B
  163.   def init/ z/ A) P' e+ f6 y  Z4 c1 h
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor+ Y& z. t) ]# [3 h
  165.     @left_state = 0
    + a: s4 H, X" \+ Z1 S# R
  166.     @right_state = 08 y  ^  a% I: }
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    # m% m, s' y: N5 J/ |7 u
  168.     @dk_count = 0 # 用于双击的判定. d8 Q) B& \" d9 e: W0 c
  169.     @clicked = false
    8 o2 Y3 }% x  m* @3 t/ `! L
  170.     creat_mouse_sprite
    8 R( L0 p# D3 b8 g# ^
  171.     update
    # n: r2 k! V0 J+ x
  172.   end/ b, u' }# _( b
  173.   #--------------------------------------------------------------------------. V6 ~8 ^) v! J/ m6 }0 T  y
  174.   # ● 鼠标指针精灵
    7 c. e% }2 q+ T
  175.   #--------------------------------------------------------------------------9 l4 y, V1 A) _- J7 r
  176. #~   def creat_mouse_sprite
    , t! _# S4 y3 C, y. W9 W
  177. #~     
    " ^8 {" T- L( d; ?1 b& {( {
  178. #~       @mouse_sprite = Sprite.new
    3 C- h$ |9 `. b3 E% o# L
  179. #~       panda = 2#rand(2)+1+ B! r) r8 k3 L5 I, X( H( F4 R

  180. 0 s4 o8 l- J2 o& U4 Z
  181. #~      if panda = 1) U0 M. s$ w' M
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    / t6 `& Z' f2 a$ r& D
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    ( u' s" q0 F& h- ]$ E; s
  184. #~        end#with if File.exist1 y! |8 {7 t1 N4 q) ?
  185. #~   
    % Y0 A0 e! v6 H) |* c6 x
  186. #~     else if panda = 2 #with if panda=1
    0 ^+ U$ x4 U  I( `+ _% c: }$ c
  187. #~      
    6 F5 M# ^+ w( u- y( b% {
  188. #~      if File.exist('GraphicsSystemCursor2.png'); e' k4 M6 z% K
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')) y4 p. Y5 I8 H! B
  190. #~      end#with if File.exist
    & Y( Z4 D; ]$ J% G
  191. #~       6 z6 c+ s% b3 P6 O" c
  192. #~     else #with if panda=18 }2 K' z5 a, ^1 ]3 ?" u
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    & A: Q  K8 Y' q, i9 o# h0 }4 _
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    8 ^+ i1 F3 ~# ^* v+ R
  195. #~       Rect.new(5  24, 24  24, 24, 24))% p/ y  ]7 @2 I& J% {5 H- @7 {$ _6 Q
  196. #~     end#with if panda=1
    - k  a6 s2 d6 Y# W7 H
  197. #~     
    % B( s8 G) d4 Y4 {
  198. #~     #with def
    & f5 ~- u2 z+ C' b  T# A% Y
  199. #~   end
    ! \3 e# ^, ~- ~8 T# T
  200. def creat_mouse_sprite
    2 N% |3 u  y7 \6 j2 G2 j" p
  201.     @mouse_sprite = Sprite.new
    5 G* j1 p+ }  H* T
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    - A6 V6 @  m, L4 L* ?, J2 t( H
  203.     @mouse_sprite.z = 9999
    / x& O7 ]+ m! r" s# R7 w7 {
  204.     Show_Cursor.call(0)3 H0 C2 n6 W& c8 j' u6 |  _
  205. end3 V/ c  p$ j' q) R1 f* {* q" g9 K

  206. - b' `6 E1 V2 l/ E+ J
  207.   #--------------------------------------------------------------------------
    9 l! w4 H8 b  e0 r, z
  208.   # ● 更新
    ( q0 \9 c4 R) H% j/ L
  209.   #--------------------------------------------------------------------------* q& }3 h; f5 }! q1 |5 B' h; n
  210.   def update+ v) @, P* `/ B1 k2 y$ \
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    $ C% p8 X& d+ q; V; r0 l; r) {
  212.     left_state  = Get_Key_State.call(0x01)
    2 w$ T' C$ n+ W& f0 w: ~
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0( T  G" ?/ h* p9 g1 v$ j8 U
  214.     right_state = Get_Key_State.call(0x02)5 G( S+ g* M& f3 {- ~8 I
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0' z$ Y$ B9 z! v7 s1 }
  216.     update_double_click9 [" R* u4 ]- }" b' Q1 p
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    : i; r5 p1 M- a$ N8 `1 T, V  w
  218.   end! A3 f& T# f6 u3 l  v; g! `
  219.   #--------------------------------------------------------------------------7 v0 l5 U+ K. T1 ^6 ~( i5 u7 a3 Q+ }0 V
  220.   # ● 获取鼠标坐标) `" X0 S  H7 h' |( S
  221.   #--------------------------------------------------------------------------
    " E2 o! B/ m. Y( V5 ^
  222.   def get_mouse_pos
    2 G$ G) Z( o) @
  223.     arg = [0, 0].pack('ll')1 }* n) f* T. l- m
  224.     Get_Cursor_Pos.call(arg)+ }4 P9 f; p, O
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    3 _1 L7 l+ u0 g* G
  226.     x, y = arg.unpack('ll')
    3 C6 p0 f4 C8 r# ]
  227.     return x, y
    7 v7 a4 e  C/ O9 w  P# M
  228.   end6 d/ f( E4 F! w& M* _
  229.   #--------------------------------------------------------------------------! C0 ?1 z( b2 C) n
  230.   # ● 将鼠标固定在屏幕内
    3 G: d8 w3 }) m: M
  231.   #--------------------------------------------------------------------------0 G' q- b1 z+ c% j
  232.   def lock_mouse_in_screen
    4 E4 b; C  s  P' W" b: z' M
  233.     arg = [0, 0].pack('ll'); A0 v% G. z5 L3 K
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    9 @. ?6 X9 W% g9 m9 u! |
  235.     x, y  = arg.unpack('ll')
    & ?: @3 N+ w. J) a' z  F; r$ A
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    - z# D: L" F" {& Y. F& h
  237.   end- @  i9 L2 |& T0 L7 Q
  238.   #--------------------------------------------------------------------------
    9 z, `- F5 x. z+ @( r, G
  239.   # ● 解除鼠标固定
    0 l# t" K( T$ M! h! |
  240.   #--------------------------------------------------------------------------
    - v3 ?! J1 w: c* R* K
  241.   def unlock_mouse_in_screen0 E6 H. A$ Z; g
  242.     Clip_Cursor.call(0)
    # }9 z7 C: |, I# o5 l! E
  243.   end
    % D9 M  C& i- p0 A$ I* E5 n. p& e
  244.   #--------------------------------------------------------------------------
    ' G# `1 Q, a5 u! d
  245.   # ● 鼠标双击判定# B, Y( Y0 j' o. H9 H+ T' ^4 r& ^( O
  246.   #--------------------------------------------------------------------------
    ; J, s( ?' @5 l* y9 S0 M: J4 k
  247.   def update_double_click
    ! s' m& `: H; X6 }0 c
  248.     @clicked = true if @left_state == 1
    # U% F$ o5 U6 }6 u
  249.     if @dk_count  0 && @left_state == 1
    6 N9 m6 Q6 a7 T, m% a' K" u
  250.       @dk_count = 0; @clicked = false
    . ~; q$ Z) C) O# K( b& c4 t* @
  251.       return @double_click = true
    " S# q7 w4 q1 D2 H" L
  252.     elsif @clicked
    0 g. O7 Y2 k7 b6 C- b9 r
  253.       if @dk_count  KsOfSionDbclick_Frame* {( a, g6 b6 }! ~. q
  254.         @dk_count += 1; k1 w: d4 \# g3 e
  255.       else
    - ^0 q8 ?0 d: l4 ?0 f0 _. s
  256.         @dk_count = 0; @clicked = false
    / ~, ^6 |9 H9 ^. A; s8 [( ^
  257.       end
    $ x  }2 v/ F0 M" V6 [( ^. H
  258.     end, Z. T/ E5 |) K2 I3 l, I
  259.     @double_click = false+ z+ ~1 i0 M) P3 z# Y+ x4 U
  260.   end
    ; C* F0 T4 i& f. q/ R0 ?+ s
  261.   #--------------------------------------------------------------------------( F; q! J! s1 T5 k, E7 R) E
  262.   # ● 按键被按下就返回true0 @4 c6 k# t+ I! X* h: x
  263.   #--------------------------------------------------------------------------0 `! e  O: @, K
  264.   def press(button)
    # p- l1 L6 ^. o; U3 b2 X3 p6 t0 A
  265.     case button7 ?$ S& @; ~- p
  266.       when 0x01; return !@left_state.zero3 B  \. R: O4 y/ k7 ~
  267.       when 0x02; return !@right_state.zero/ Y( Z) j$ u( n
  268.     end
    9 @! }- {2 T+ y$ P1 o# p
  269.     return false4 G' m6 l- x4 l: m
  270.   end
    ! z8 z2 w- j1 ?6 T
  271.   #--------------------------------------------------------------------------0 m" v/ ~% N" S) D
  272.   # ● 按键刚被按下则返回true
    ' H$ P/ W8 O2 @# M
  273.   #--------------------------------------------------------------------------6 B  N) b# ^, U* j, F) R
  274.   def trigger(button)
    . v$ i6 N5 x8 Z( i" C/ |
  275.     case button
    + a( ^/ ^, A2 z4 w: j" X' E9 s% n
  276.       when 0x01; return @left_state == 1
    6 _: `3 H1 {/ b
  277.       when 0x02; return @right_state == 1
    ' i- g1 p7 m# p4 }$ q3 j+ I
  278.     end+ v" t! z8 @% K# p
  279.     return false
    # I  v* y3 `( g/ w; _
  280.   end! u. p9 {0 ^3 Z( v' C, g
  281.   #--------------------------------------------------------------------------
    , d- ?; X7 l+ e+ y) f4 j
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true" a' Y3 G2 q8 i' n; j6 {+ {
  283.   #--------------------------------------------------------------------------
    1 ^6 e" w8 ?$ X+ T% e1 m6 |
  284.   def repeat(button)% g9 P3 Q' U- P* z) v- G: O
  285.     case button  M& _1 S  t; @' _' D0 w, V
  286.       when 0x01; return @left_state == 1 " X( T' L, n& X; Y
  287.         (@left_state  22 && (@left_state % 6).zero)6 Y3 F6 ^  T. ~7 y5 j' p6 b; Q
  288.       when 0x02; return @right_state == 1 " H, A: c, E, [. a
  289.         (@right_state  22 && (@right_state % 6).zero)
    . I7 b! v  n0 p0 X0 b
  290.     end
    $ c% g" J7 K; Z; |6 M. Q0 r
  291.     return false7 H! z; L6 u8 W. K& n% a
  292.   end8 V7 ~+ f! u' g+ x5 t! C0 a
  293.   #--------------------------------------------------------------------------- [% u. R1 S' Y) ~0 W5 j" t4 K
  294.   # ● 判断是否双击鼠标
    2 w# ?) }9 Z. e: q
  295.   #--------------------------------------------------------------------------
    # L# L8 |' c' ~9 V, p* t4 S2 k
  296.   def double_click. K% t$ |1 M. q5 e' Y3 g& C
  297.     @double_click
    8 Q, v9 x5 h+ \. ^; V
  298.   end
    9 W, L; f4 n1 ?5 H
  299.   #--------------------------------------------------------------------------0 y4 q# h$ Q4 z
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)* B$ R& ~% h$ m# G# I
  301.   #--------------------------------------------------------------------------
    ) g7 y% h/ K0 H8 j4 o. n
  302.   def click_count
    6 u# ]& b9 ~( }4 J
  303.     @ck_count
    8 @# q, D3 K6 I1 ]  T
  304.   end0 _( @% K* V1 d0 a4 v
  305.   #--------------------------------------------------------------------------
    9 i) k$ j- U3 D
  306.   # ● 获取@left_state(按住左键每一帧+=1)$ B) z! x! M; F, o0 c) M/ T% O
  307.   #--------------------------------------------------------------------------( T8 z2 v9 q- Q! m" q) Z
  308.   def left_state# r* V- X5 G" w; b. _0 ?& S( @
  309.     @left_state2 V; h, u) s& Y8 s
  310.   end
    ! S- {& [* u3 ~' Y+ t& Z! B
  311.   #--------------------------------------------------------------------------9 {, R# ^& N  N8 f& q; E, w( ]
  312.   # ● 获取鼠标的x坐标
    $ v) t9 ~1 ^) J3 Q. ]6 b6 K/ _
  313.   #--------------------------------------------------------------------------
    - Z! R7 s& g) K1 K7 G0 F9 ^
  314.   def mouse_x2 l* p8 E9 P& c
  315.     @mouse_sprite.x
    & V; l+ W3 ^5 k5 V0 [
  316.   end7 y. O# I3 U5 q/ x( v" V2 C) O6 B
  317.   #--------------------------------------------------------------------------
    ; ?# j. W% Q4 ]4 E
  318.   # ● 获取鼠标的y坐标% R$ Q' }- b% T! B* l7 F6 q, W# [4 L: x
  319.   #--------------------------------------------------------------------------9 h; e6 o5 ~4 N" G3 l9 u
  320.   def mouse_y, E3 g, {( t1 k' [
  321.     @mouse_sprite.y# }) C. v5 {) a/ _
  322.   end- n5 g6 A& K4 R* c1 S8 B% C
  323.   #--------------------------------------------------------------------------2 w' z# m* h9 U3 ~0 ?
  324.   # ● 设置鼠标坐标7 x- B- n, v+ D
  325.   #--------------------------------------------------------------------------
    6 \# x. `: D3 L2 a* J
  326.   def set_mouse_pos(new_x, new_y), e& w7 n( G% d" ~
  327.     arg = [0, 0].pack('ll')/ t! g5 S1 P+ ?7 `
  328.     Screen_To_Client.call(Window_Hwnd, arg)0 u& h9 p. `8 v) o$ H0 l( L
  329.     x, y  = arg.unpack('ll')
    - Y$ p) G( E, D3 c
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    # ?! r8 E6 t& q, x: Q% j; h  p
  331.   end8 K) U- o- `# M* \
  332. end #end of class  self : X$ Q8 Q: z# f# `: J7 T# H

  333. & x3 o! v$ E1 V& C$ q4 S3 x5 o; }
  334. end, k7 R; X' N0 ?' K

  335. ; b4 _* }/ e5 k. C- n2 A: u
  336. #==============================================================================; ^! v  d% J. V7 B4 ^
  337. # ■ SceneManager
    # t# o" b- @$ b) _8 g3 G
  338. #==============================================================================
    5 ?* f; ^! Z& Q. p
  339. class  SceneManager
    : j7 T0 W* S: l* l$ a
  340.   #--------------------------------------------------------------------------) `% C' f9 W1 b4 E  q) d8 k
  341.   # ● alias: Y- f9 w! f4 s5 f* G' }, D
  342.   #--------------------------------------------------------------------------3 F+ Y! W/ t, _. b, L& O& ?
  343.   unless self.method_defined(sion_mouse_run). t3 _2 m. t( K! e
  344.     alias_method sion_mouse_run, run
    6 ]- @+ I" X4 A9 j" v( q7 _
  345.     alias_method sion_mouse_call, call1 s) j) P; m  o% R) |1 C: V' Y' h
  346.     alias_method sion_mouse_return, return  o% `" _# J5 z5 h$ C$ W
  347.   end
    6 Q9 T$ v6 U# m% |+ n
  348.   #--------------------------------------------------------------------------
    ' g, ^& C2 k* i, n/ @, ~0 t
  349.   # ● 运行( {4 `0 n8 V  Q3 D) [
  350.   #--------------------------------------------------------------------------- l, X/ k& L1 f, k1 F- g( I8 m) ?, z
  351.   def run0 V! n5 {3 P' a# A7 X
  352.     Mouse.init& l- ]9 [( ^9 O# ?* |6 s. H
  353.     sion_mouse_run. x7 a" v. f2 K6 i3 F1 ^
  354.   end) D3 r+ `& E4 j6 ^: Z
  355.   #--------------------------------------------------------------------------
    ; R5 F; P. g) e6 O
  356.   # ● 切换4 k* N/ M3 |% f; n
  357.   #--------------------------------------------------------------------------
    # {* a0 {9 B0 t% I
  358.   def call(scene_class)
    % B2 }, R9 Z2 w7 V
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)! s1 D/ O3 w5 y& I: x1 }: u
  360.     sion_mouse_call(scene_class)' _" }* }8 w2 H- N! V8 L
  361.   end  O4 M+ `4 M( M1 M1 t+ k; r* v, a" k
  362.   #--------------------------------------------------------------------------! _- U3 H) V8 L0 \/ P: f
  363.   # ● 返回到上一个场景
    # H  S0 @8 }# ^* [; r
  364.   #--------------------------------------------------------------------------
    1 v9 Q. e2 P! X. n4 w
  365.   def return
    1 \/ W, L6 i* N3 t$ ~  Y; }
  366.     sion_mouse_return+ r7 F4 b+ E) |
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    & O, W" ^9 b* j4 L
  368.       @scene.instance_of(Scene_Map)
    / \' {; o0 k  _3 o
  369.   end/ i( D% c. e4 Y3 e" n* k; n
  370. end
    0 z+ Y3 J+ V, t- i
  371. ; u6 N, w. |+ b( T, ^* w5 p5 L
  372. #==============================================================================' e% H( s* @( t
  373. # ■ Module Input
    7 P$ W5 c* y. G- u( o8 O
  374. #==============================================================================2 \, n; z% [# A
  375. class  Input* n! H* a+ M: u" T+ }* v8 H- u
  376.   #--------------------------------------------------------------------------
    0 C2 n) J3 o7 i' K; K
  377.   # ● alias
    & X; {4 W5 n5 z
  378.   #--------------------------------------------------------------------------
    % y5 j$ t* M! E* g% {: T: _- [7 u
  379.   unless self.method_defined(sion_mouse_update)
    2 V# w5 b! `& c7 d' h4 ]- |
  380.     alias_method sion_mouse_update,   update" F1 ]7 [# b, Z
  381.     alias_method sion_mouse_press,   press5 r  P7 q7 }0 @- r
  382.     alias_method sion_mouse_trigger, trigger5 x" D" f. @  B6 ^( s
  383.     alias_method sion_mouse_repeat,  repeat
    & B* U% X" [; e4 e6 H
  384.   end" u) \0 l. b5 D  S* |7 P  k  K
  385.   #--------------------------------------------------------------------------9 i$ ]. i, z0 A+ d+ u& R$ F
  386.   # ● 更新鼠标' [0 D: R9 ?4 h# v6 b, x) [
  387.   #--------------------------------------------------------------------------
    9 B9 x% {  B7 v9 G0 |/ n
  388.   def update; L& K( c1 z& |7 \! j
  389.     Mouse.update4 N5 X# m" A. B5 q
  390.     sion_mouse_update
    ' b4 G6 d9 J0 v5 J
  391.   end& X' s1 @  U6 t+ ^$ P
  392.   #--------------------------------------------------------------------------
    " [& C5 Y" ?$ w: J
  393.   # ● 按键被按下就返回true) t  A: a2 T& u3 X/ f: W( O: Q* B
  394.   #--------------------------------------------------------------------------
    & ~+ I; k% m# ^1 P9 g
  395.   def press(key)+ p# U' X) R8 I
  396.     return true if sion_mouse_press(key): \6 |1 o8 @3 F" I+ e# v
  397.     return Mouse.press(0x01) if key == C
    ! |% Y5 i* s& y
  398.     return Mouse.press(0x02) if key == B3 D! B/ f/ w3 U+ z1 Z6 c6 v3 n
  399.     return false. d% ^' O7 p8 w! p
  400.   end7 [1 P! k; B; ]9 }9 q
  401.   #--------------------------------------------------------------------------) G) r  e4 e0 @9 E
  402.   # ● 按键刚被按下则返回true
    / s6 \) G! T8 ]3 D# U  \
  403.   #--------------------------------------------------------------------------1 }0 a+ k5 w) K7 e
  404.   def trigger(key)
    6 u8 t) M4 C* A7 t# O
  405.     return true if sion_mouse_trigger(key)
    : N  j* C1 U8 v2 E
  406.     return Mouse.trigger(0x01) if key == C
    3 x$ H0 x7 I6 A' p; X+ C' j; x4 p
  407.     return Mouse.trigger(0x02) if key == B9 q' \, V1 Q" y/ W+ Q/ e& f) `3 d, y3 [
  408.     return false
    4 L  k3 y! P7 y% S( `
  409.   end
    9 t) \$ |* A& B
  410.   #--------------------------------------------------------------------------4 E: a" k, c, y6 L% k! H3 y( M6 c
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true; F1 t0 q) h. {5 x7 j
  412.   #--------------------------------------------------------------------------0 w9 [3 ~$ l& z* @; }
  413.   def repeat(key)
    * N! w) n" P1 |
  414.     return true if sion_mouse_repeat(key)
    ) \( L7 o4 S% j4 o" a3 ?' U+ {
  415.     return Mouse.repeat(0x01) if key == C
    ' ?* v' C% r+ A9 L8 `& O3 H
  416.     return Mouse.repeat(0x02) if key == B5 o2 l" [7 z3 t
  417.     return false
    " l  O# @. L9 o
  418.   end4 ]3 X7 Z, ^( e2 G# O
  419. end: c. ]; i& ?8 r! J, v

  420. 2 Z6 W9 b2 V! A; P% O7 W
  421.   v6 l& {( q  H9 q% ^: [- X. W; z
  422. #==============================================================================1 l. V; E; R8 E' i9 h
  423. # ■ Window_Selectable
    $ D7 F5 b* C1 L: ~7 Y/ `' M
  424. #------------------------------------------------------------------------------4 i, h) X7 H1 S( {" C+ q/ K
  425. #  拥有光标移动、滚动功能的窗口5 X5 m! I6 y0 {0 L
  426. #==============================================================================! ?4 q9 I0 Q  H( e
  427. class Window_Selectable. B0 k3 ?4 U7 e0 G! R* F7 n
  428.   #--------------------------------------------------------------------------1 h# m3 A2 V* v; y2 o8 U- U
  429.   # ● 初始化' I/ c' ~: `; d. w( B) d6 m8 u9 Q
  430.   #--------------------------------------------------------------------------  K6 g* J7 N2 a. s( N
  431.   alias sion_mouse_initialize initialize
    ; |9 t1 ~6 E0 M# m. j6 E4 U* y5 @
  432.   def initialize(x, y, width, height)& j4 s( p6 Z$ p* E5 a
  433.     sion_mouse_initialize(x, y, width, height)
    3 n5 [5 |5 A6 Y1 H1 s0 _
  434.     @move_state = 04 Y6 D1 w) ~# Z4 s0 B$ s2 r
  435.   end, e. o* e# H1 u0 s
  436.   #--------------------------------------------------------------------------
    * C( B$ n% ?' R% o' H* f
  437.   # ● 更新" k2 t# j7 m! d6 i7 \- ]! i( l! A
  438.   #--------------------------------------------------------------------------
    7 Y/ O0 ]% v1 R6 t
  439.   alias sion_mouse_update update; U  L0 J) [8 E$ y
  440.   def update% T$ y  |1 L4 x
  441.     sion_mouse_update
    7 R9 C! w7 L9 \5 e3 ?: ^
  442.     update_mouse_cursor
    7 L! g$ a+ U8 |% R" u
  443.   end
    + |9 a2 @2 }8 g& r2 x
  444.   #--------------------------------------------------------------------------
    * |$ j4 T7 `- S5 x5 X. r
  445.   # ● 启动后设置鼠标到index位置8 J- F0 r! W& R' C7 H6 K8 n" p
  446.   #--------------------------------------------------------------------------
    + _& p1 O. Q* i5 B! l
  447.   def activate+ @8 o! ~* x% p, H! Y* P
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    9 w3 h: i4 ]9 p$ q. ?) n
  449.     super
    ) |' l! k, x$ H; D3 {) d
  450.   end
    $ [# B* f$ h( z! \/ U
  451.   #--------------------------------------------------------------------------
    1 y0 `2 T" _  ~, q) S
  452.   # ● 更新鼠标和光标的位置! x6 }* Y* h6 b+ s8 u
  453.   #--------------------------------------------------------------------------/ W  P5 C1 g# h2 ^9 ^8 c% R
  454.   def update_mouse_cursor" T. I/ Q1 ?$ o! U6 i
  455.     if active
    1 A7 d3 e2 G- r) Z3 E9 o' D" w
  456.       if @need_set_pos0 u4 u! Q/ C& V' ]/ ?
  457.         @need_set_pos = nil
    - M) z. w8 i2 O) M# _4 R9 h6 F
  458.         set_mouse_pos1 v( {: E' P$ J' ~
  459.       elsif cursor_movable( Y; Q' A" D! c* n$ z% W$ e
  460.         Input.dir4.zero  set_cursor  set_mouse_pos$ z0 u' b& d! y( |* }5 @+ s
  461.       end$ o& ?( Z( X. [% v
  462.     end0 S' w5 F: R/ G5 w( r7 w2 c$ B
  463.   end9 n# X% |& D0 b
  464.   #--------------------------------------------------------------------------: U1 H" `3 E' F1 S1 d
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    ; A: b  B" K( o+ l1 i0 \
  466.   #--------------------------------------------------------------------------" _& d$ e8 P( H
  467.   def set_cursor
    7 j  R  u% s! n% W% q
  468.     mouse_row, mouse_col = mouse_window_area
    - @( W" N9 \7 y2 ?2 T; P( @
  469.     if    mouse_row == -14 W8 |& |+ o3 P( O8 U* k
  470.       @move_state += 1 if need_scroll4 |) k* A) W) q& W
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    7 m' }) j1 Y0 p0 B+ r$ |
  472.     elsif mouse_row == -2) V% P7 f3 U# b
  473.       @move_state += 1 if need_scroll
    7 s& ^+ i% w* J0 M, O, Z' ?9 X8 C
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand% G9 S, c. `) z. G4 r) K
  475.     elsif mouse_col == -1& t% N& f/ `/ L+ R  j
  476.       @move_state += 1 if need_scroll
    5 _9 `0 a5 F  M4 Q- E* l
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    ! J- _) ?* J" f* h6 u, p
  478.     elsif mouse_col == -2' O( r6 r% [. ~7 f+ E
  479.       @move_state += 1 if need_scroll1 E6 V) O2 X# H( X  o* X
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    8 s7 R6 z/ [0 ?2 ?' |
  481.     else: f. v7 }7 z) _- q
  482.       @move_state = 0* `; G! J7 A# O9 Q
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    7 Z$ ~, o7 E9 `$ V, y" F
  484.       select(new_index) if new_index  item_max && new_index != @index
    - v; \% _6 M% a  c( v% N0 t8 W# R9 ?2 O" S
  485.     end9 _% t3 M4 k9 T8 Z1 P
  486.   end8 u4 Z0 f1 p6 n$ e" \- l2 P
  487.   #--------------------------------------------------------------------------5 }' t# v0 e+ U4 o. W' d
  488.   # ● 判断鼠标位于菜单的第几行、第几列: F7 M# m" ?" V* L$ W% L
  489.   #--------------------------------------------------------------------------
    8 q; B2 z% Q, r2 |
  490.   def mouse_window_area+ H" `3 K5 P8 g# Y9 o% E8 b+ E) y8 s
  491.     if viewport.nil # necessary!
    - y) R! g8 v8 g9 G& `' W
  492.       vp_x, vp_y = 0, 0
    7 r3 q/ ~' W& D9 Q1 \2 x* _
  493.     else8 r2 ~  ]% F1 l: g; N- a. s1 L
  494.       vp_x = viewport.rect.x - viewport.ox
    ! ?0 H4 D! B7 K% N5 ~- |
  495.       vp_y = viewport.rect.y - viewport.oy0 |6 m6 t) Z6 [# g
  496.     end
    & n! U/ n* g$ _8 g; B0 I
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y" q8 L( _% ^; U) A0 a
  498.     item_x1 = vp_x + x + standard_padding / P  ~. m$ Q" c7 D. _4 f  g
  499.     item_y1 = vp_y + y + standard_padding" }8 n* N' r; x6 r1 }/ O9 n
  500.     item_x2 = vp_x + x - standard_padding + width* d# A, e0 Q" ?; e4 w
  501.     item_y2 = vp_y + y - standard_padding + height0 u2 `5 g9 d  @; {! h
  502.     if mouse_x  item_x1
    $ \/ X, ~* Y( i
  503.       mouse_col = -1' q) X- ]! J2 t0 ?
  504.     elsif mouse_x  item_x2( n: ?' m* f6 N; E- \2 N: o6 p
  505.       mouse_col = -2
    7 Z  H: c7 s; `: ~# T; i
  506.     else
    - p* C% E! C; Q. m
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)# e/ E0 {% Y& @
  508.     end: g! W- u$ K6 m* x; E$ G; l* l
  509.     if mouse_y  item_y1. W* o9 j% I$ G) p8 i! m  l/ v1 t
  510.       mouse_row = -1
    . }) V9 o" J7 ?8 f+ @2 S
  511.     elsif mouse_y  item_y24 e- Y: O! m" G, U# F
  512.       mouse_row = -2
    . u1 m" p- ~2 s
  513.     else
    ' Y8 W( d4 N4 d
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    - l. S1 t! P' I$ R0 G# h
  515.     end8 u" [/ m& s; N  F
  516.     return mouse_row, mouse_col. f. C, Z+ c/ C) l5 t1 [
  517.   end( n4 l: a7 F( N  M5 _9 ?7 L
  518.   #--------------------------------------------------------------------------. Q/ L0 W. H% ?8 M+ J5 m7 c
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    4 S' r/ i$ L( z9 k8 \
  520.   #--------------------------------------------------------------------------; p& B: d3 H; S  t  Q/ g
  521.   def set_mouse_pos
    . y6 V1 c; N1 T( W& J6 o
  522.     if viewport.nil # necessary!
    ! z0 i6 f9 y% j* \
  523.       vp_x, vp_y = 0, 0
    + U' s7 T6 D" h# v3 D1 e( K  F
  524.     else& ]1 ]* s& b/ ^3 f0 y
  525.       vp_x = viewport.rect.x - viewport.ox+ u9 k; e) V; B
  526.       vp_y = viewport.rect.y - viewport.oy
    2 c0 I; ~% i6 ]' x- k
  527.     end0 Z7 g) t2 f# @; `* M  p# ?4 v
  528.     item_x1 = vp_x + x + standard_padding
    0 }6 j$ I' l- n4 K. F/ z
  529.     item_y1 = vp_y + y + standard_padding, g2 m, C- C5 P1 b6 w
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    ' r% K( C, J' j8 [' S
  531.     row = get_index  col_max - top_row
    2 B& a* A: v& i; V4 u
  532.     col = get_index % col_max( ?" R; W3 ~& {0 e( l- F
  533.     new_x = item_x1 + item_width  (col + 0.5)# ]1 f* ]4 N0 e0 p$ X+ O
  534.     new_y = item_y1 + item_height  (row + 0.5)8 q0 D4 C3 z- A
  535.     Mouse.set_mouse_pos(new_x, new_y)
    # q9 b1 j& b8 j/ m
  536.   end
    4 ^, n$ t# @9 [' N; |4 J
  537.   #--------------------------------------------------------------------------
    ; m& c! V2 |' y
  538.   # ● 判断菜单是否需要卷动
    0 Z  X, g$ }& f+ W
  539.   #--------------------------------------------------------------------------
    0 E( o0 K, z- O1 G+ v* G
  540.   def need_scroll* z. g6 P- V' r2 B# \9 C0 ^% t
  541.     item_max  col_max  page_row_max
    : ]4 |. R5 q* T/ l
  542.   end
    ! O3 |, B9 X! c
  543.   #--------------------------------------------------------------------------
    * k2 l0 M- w. x7 e0 c/ E
  544.   # ● 判断是否为水平卷动菜单* T  M* J! d! m) [7 y) ^9 V
  545.   #--------------------------------------------------------------------------" @9 `; Q* Y( S" k9 `" o: C
  546.   def is_horzcommand+ S0 o8 T/ I5 Z5 W7 j
  547.     return false( E) l: Q( X% i' g- Y1 J* W2 F1 P
  548.   end8 |1 d, `& U7 x
  549. end
    4 C' v9 Y* n  A" [
  550. , h+ K/ U1 [! b% S. {
  551. class Window_HorzCommand
    * p, H7 W$ `3 X0 [1 q/ a
  552.   #--------------------------------------------------------------------------  o1 n+ q( \& y1 c
  553.   # ● 判断是否为水平卷动菜单
    & s! v# K/ s0 Q
  554.   #--------------------------------------------------------------------------4 r; Y9 h6 G5 l& x; B. W
  555.   def is_horzcommand
    9 U$ A1 C% Q" Q# h
  556.     return true7 _0 F- m: D$ L# b. m
  557.   end0 \" G& m: x5 j5 ]4 e1 [  }5 \- B$ k
  558. end
    * ~7 \/ n) n9 d

  559. 6 ~+ V2 O2 G4 Z
  560. #==============================================================================# S9 C# s" W: ~; X3 `+ Z( Z# }
  561. # ■ Window_NameInput
    - l' l% z" z" {0 K# X
  562. #------------------------------------------------------------------------------  ~2 z& A. P- y; x& a" S8 J/ @
  563. #  名字输入画面中,选择文字的窗口。. ]9 Q  D' i3 Z
  564. #==============================================================================+ V8 e. _; F9 O+ @# F
  565. class Window_NameInput0 J$ n" D" f3 y. U% T
  566.   #--------------------------------------------------------------------------$ _' v" |6 ~* p$ B+ E; ^7 x+ K" A
  567.   # ● 设置列数
    " ^5 N- t* s* u% m# W! i! }9 ^
  568.   #--------------------------------------------------------------------------& I  @6 ~, k6 B# T' r  A- j0 \4 |
  569.   def col_max4 l5 u8 C) k6 ]9 q1 G3 X, k4 L' D
  570.     return 10& h+ g( o8 l* J
  571.   end& y) I4 P7 d- o$ `( X: Q
  572.   #--------------------------------------------------------------------------+ }3 }8 r8 u) y# t, C
  573.   # ● 设置填充的Item个数
    ' S  \# `" A5 o& t0 b4 W
  574.   #--------------------------------------------------------------------------
    + ]4 _# }0 a+ t8 c. l2 `0 {
  575.   def item_max/ b. z) o$ H! |/ X! |, a: E
  576.     return 90
    * O0 X9 N/ ?8 T* m
  577.   end
    , f3 |) d, E/ c1 z( ^6 V% F  `+ P
  578.   #--------------------------------------------------------------------------' s+ `; ~% v. ^
  579.   # ● 设置填充的Item个数, R" _- ?% H+ F/ W/ q4 k  p3 I( Q
  580.   #--------------------------------------------------------------------------
    2 a) \1 ^/ [, q* \, N! s
  581.   def item_width% Q, S" ]* t. K5 H5 F  r; R
  582.     return 32
    6 N! Z3 q. [4 g9 S
  583.   end9 ^: H3 I" ~, p" u
  584.   #--------------------------------------------------------------------------
    , R1 y) l. g! P! J5 _7 U! a6 p9 b
  585.   # ● 判断鼠标位于菜单的第几行、第几列6 I) p2 w9 |5 S# h
  586.   #--------------------------------------------------------------------------" X3 ]% T2 \6 h# D4 V: Q3 ^/ ?
  587.   def mouse_window_area7 \1 ]% Q: Z2 ?$ U1 r! D
  588.     if viewport.nil8 d0 n) ]% m/ z, D+ N; x# ~/ N
  589.       vp_x, vp_y = 0, 0
    * T0 Q  `( \" U" Z: L
  590.     else5 x. w6 L. n% J: |
  591.       vp_x = viewport.rect.x - viewport.ox1 N$ u- F3 b, M! }. w5 w4 M
  592.       vp_y = viewport.rect.y - viewport.oy( {. E) j8 W+ O5 A6 o1 Z
  593.     end
    $ X( N  r9 H2 Q6 s4 T0 d
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y- S2 }! o) O' F6 \9 p, u2 H9 Z
  595.     item_x1 = vp_x + x + standard_padding
    7 t/ M& w) L2 d
  596.     item_y1 = vp_y + y + standard_padding& t- Z, q, O  V* I  G" K
  597.     item_x2 = vp_x + x - standard_padding + width6 z6 r. L! b7 X5 T8 ^- \
  598.     item_y2 = vp_y + y - standard_padding + height
    6 f# v- t% c1 i+ W3 f2 l
  599.     if mouse_x  item_x1
    8 ~! ^, G" p. a; y& A3 t' q. q
  600.       mouse_col = -1
    ' C( w! E, ?0 q- Z! V1 m
  601.     elsif mouse_x  item_x2) f8 ^+ i6 G+ H. Z$ o- k4 y2 R
  602.       mouse_col = -2
    " b9 B2 ]3 H) A2 r. Y
  603.     elsif mouse_x  item_x1 + 1600 r2 T( [  @: ?! X* A1 D3 t
  604.       mouse_col = (mouse_x - item_x1)32/ o' r' H/ \5 Q
  605.     elsif mouse_x  item_x2 - 160
    $ {" {8 i& L* {0 [5 s* R/ ]& R3 m
  606.       mouse_col = 9 - (item_x2 - mouse_x)326 G2 n" N$ W7 @$ O! o3 [& X" ~3 ^
  607.     else
    ; j9 J9 O1 i$ l+ T' ~4 Q# i2 ^
  608.       mouse_col = mouse_x  x + width2  5  46 M& B' z+ \% k" O8 d
  609.     end
    1 ^. I* d- B8 m) ?
  610.     if mouse_y  item_y1
    & a3 j5 a0 H4 @" |
  611.       mouse_row = -1* Q: K; B4 v" R# \' [5 A8 y
  612.     elsif mouse_y  item_y2
    , L3 p: T- [6 F( s% f& M: f. J0 E) W
  613.       mouse_row = -2
    5 m- k9 Q, p" ?
  614.     else
    3 n4 p& e+ H* A  ]
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)+ |5 ^* Y; T' J3 C; O: Z+ F$ [
  616.     end
    ' B# h  g# `1 Z1 |& R2 s8 [
  617.     return mouse_row, mouse_col; x0 G, |- y# u; r' E
  618.   end7 {% W& k+ Q9 i/ N9 e% t5 ^/ K6 c
  619.   #--------------------------------------------------------------------------
    ' Y3 S$ l5 p% ]9 U* W, H2 K
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    5 m  D  [' u; a' W* d2 o# {
  621.   #--------------------------------------------------------------------------
    7 U) V- a$ g3 K# i5 R2 P; O/ r: Y% }& L% P
  622.   def set_mouse_pos. s9 h; C1 V4 O% a* I$ a
  623.     if viewport.nil # necessary!
      \4 a4 z2 a( G: j( C
  624.       vp_x, vp_y = 0, 0, t- S5 o, Z0 j3 F, I$ S' p* |8 p
  625.     else
    2 \2 ~. P! i+ C& {$ l7 ?1 {8 ~
  626.       vp_x = viewport.rect.x - viewport.ox5 d/ C+ a' {# D" d6 o) K
  627.       vp_y = viewport.rect.y - viewport.oy
    ! C; j+ a- R* A' H
  628.     end9 }9 T5 d9 u$ w
  629.     item_x1 = vp_x + x + standard_padding * A3 V( _0 @% b. N2 z, s) N
  630.     item_y1 = vp_y + y + standard_padding, o' V' s% G" t3 C% o
  631.     get_index = @index  0  0  @index
    $ S& d" F* ~( w
  632.     row = get_index  col_max - top_row( p. H" f+ g8 {# ?9 Y. j% A: V
  633.     col = get_index % col_max
    ' Q# V& j# C% K! q* Z! I4 F! @: `
  634.     new_x = item_x1 + item_width  (col + 0.5)
    ' Q( S! O9 c; J% w3 p
  635.     new_y = item_y1 + item_height  (row + 0.5)
    3 Z5 R, ?- s. s; r1 o* y5 f
  636.     new_x += 14 if col  4: Y3 l" I  ], y: q; i
  637.     Mouse.set_mouse_pos(new_x, new_y)2 y* f/ _# `6 _0 Y" v) j
  638.   end
    , K4 W# l$ f8 B2 j4 S
  639. end; f. O; t) x( v0 x" V2 {9 p( b

  640.   x2 e8 \5 ?% H0 q* l
  641. #==============================================================================
    2 z$ g) w3 z) R, d0 q1 z
  642. # ■ Window_NumberInput
    + `: l( b2 }, v) E- M1 F) ^
  643. #------------------------------------------------------------------------------
    , l" r& D9 i( E
  644. #  重写了数值输入的方法以适应鼠标& n) M/ b, T- X5 R. \
  645. #==============================================================================
    / W/ e# M6 o7 w2 q
  646. class Window_NumberInput  Window_Base4 |; c2 H" n- `9 ^, A$ L
  647.   #--------------------------------------------------------------------------% f; U' O- |" d* T! E
  648.   # ● 定义实例变量0 U; [1 D& L, t7 t/ a
  649.   #--------------------------------------------------------------------------- T; i6 |. d" Z5 Z, D0 K: K
  650.   attr_reader extra_window) I. H2 K* `, l2 O- Y  s' F
  651.   #--------------------------------------------------------------------------* T& n, `! ?& i+ q) X$ j. H
  652.   # ● 初始化- v* g( Y2 q" A  `3 q
  653.   #--------------------------------------------------------------------------# L3 ~0 c$ {2 H8 T: h# {
  654.   alias sion_mouse_initialize initialize1 ?+ [" Z) _# \0 U3 w) }3 D3 n
  655.   def initialize(arg)
    , |1 U# O8 J- ^( p& e& T  Y* w: t
  656.     sion_mouse_initialize(arg)3 d) k$ t* y/ u, Q8 F% Z% `
  657.     create_extra_window
    0 L& {( M4 F0 r. w
  658.   end7 X5 _4 v! P2 o, c. b
  659.   #--------------------------------------------------------------------------+ ~5 N  G0 s2 K8 N8 o$ E. a
  660.   # ● 启动2 r: Y8 Q* c" J' d- Y5 u4 C" f7 p+ t
  661.   #--------------------------------------------------------------------------. f: w) e; e- c6 ~/ U
  662.   alias sion_mouse_start start+ k5 T; q1 q& w. c$ x9 T
  663.   def start$ ?2 P$ |/ O8 s7 Y
  664.     sion_mouse_start
    6 ]6 ]! h* j, F0 `
  665.     deactivate  p& A  V. y0 v2 U/ Q
  666.     extra_start6 |4 ?9 k: f: g8 z/ }, B! x
  667.   end) i" z% A( C: |7 _4 h3 `8 m5 J
  668.   #--------------------------------------------------------------------------6 {% F' h! x4 U$ T
  669.   # ● 创建新的数值输入窗口$ @: C( F6 q, }. d  A; Z/ Z# {4 C
  670.   #--------------------------------------------------------------------------" f  c3 V* f2 K5 i* q
  671.   def create_extra_window& M' v; l! {* \( ]
  672.     @extra_window = Window_NumberInput_Ex.new* J1 t# r9 x+ e+ ?9 V
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    : v/ N* @; k8 X, @8 Z
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    . f  t+ R8 y. X
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    : z$ ~, d3 U' \# U4 s1 Q9 {
  676.     @extra_window.close_proc   = Proc.new { close }
    & Q9 P# J# ]+ U. e# R4 Z
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    , N! c8 n7 f) r
  678.   end( w$ t. B# k0 G' Y3 I
  679.   #--------------------------------------------------------------------------
    $ a) |0 G" a2 {6 P
  680.   # ● 激活新窗口
    . ?5 Z4 v! |  m
  681.   #--------------------------------------------------------------------------8 `. |" o8 C& w3 L5 X" N$ C) a0 E( ]( |
  682.   def extra_start+ N- X2 C: Z8 k9 T0 d' E9 I) ~4 s
  683.     case $game_message.position
    5 O8 ?9 x$ n( f  z9 P* k' b3 t
  684.       when 0; @extra_window.y = y + height + 43 a% A$ Q' R& l" Q& s; F8 L
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8; `4 e* L: k! N2 M
  686.       when 2; @extra_window.y = y - @extra_window.height - 4' u6 L8 w* b! N' A; q8 D5 {
  687.       else  ; @extra_window.y = 8- s9 \- z5 G7 I& Q0 p
  688.     end0 P) |" [; _5 ^
  689.     @extra_window.variable_id = $game_message.num_input_variable_id3 V4 O5 K$ A9 e0 b0 d
  690.     @extra_window.digits_max  = @digits_max
    ' }# P) b) [1 r- _
  691.     @extra_window.number      = @number7 l3 X/ e1 n/ Y+ N' l! F( E7 T8 w; p
  692.     @extra_window.open3 a# i1 H8 i% [4 p5 K" K2 F
  693.     @extra_window.activate
    # s# e% M5 J; J! {9 z5 W
  694.   end
    & \% r* i3 u2 w
  695.   #--------------------------------------------------------------------------
    5 I3 U$ ^# D5 I4 {/ y  m
  696.   # ● 更新
    ( @. |4 Q4 e  X8 r$ j
  697.   #--------------------------------------------------------------------------
    , y$ K4 n7 j/ w) \$ H
  698.   def update; q& l7 `' h/ T$ F& U
  699.     super
    + z# u1 v4 C# z# a' H. Y
  700.     @extra_window.update
    # n: Q& F3 n  n- a( [$ u( i% h
  701.     update_cursor
    # q" @) ^7 T1 z4 B0 m
  702.   end
    ' W$ @3 v; f0 z) p  f
  703.   #--------------------------------------------------------------------------
    2 L8 j% Z) ]0 l, `. E
  704.   # ● 关闭窗口' b+ R/ c3 M3 r$ x7 A! }. k
  705.   #--------------------------------------------------------------------------
    $ {! t; i7 K/ b/ }+ X7 @
  706.   def close
    ' N. r# v% s# X
  707.     super
    - X: ]& `' G6 U1 y$ q' `0 V% n) d
  708.     @extra_window.close1 w& X  J9 u5 e& u  d  x
  709.     @extra_window.deactivate
    ; ?6 k  l' i2 {# T7 |; O
  710.   end
    ; [( Y; c% J$ m' I. K
  711. end; S- u/ w. o, ^' p: P$ n
  712. ( }# X7 L0 D0 s  F% @
  713. #==============================================================================
    5 x/ j/ ^8 p$ v0 f; N1 o* T
  714. # ■ Window_NumberInput_Ex
    $ G1 y4 ?+ n, m% u: A# _  B
  715. #------------------------------------------------------------------------------9 c; W" O+ s$ `/ z5 N
  716. #  新的数值输入窗口(NewClass)( X3 r& J2 K( V
  717. #==============================================================================5 j. R9 ?" V+ \$ [$ _
  718. class Window_NumberInput_Ex  Window_Selectable6 h* {. P7 E: a  N3 n- }8 {& |% _
  719.   #--------------------------------------------------------------------------* V( t1 O, {/ S
  720.   # ● 定义实例变量7 F  O! N4 Y" k7 R( q( O) [) S
  721.   #--------------------------------------------------------------------------
    $ x: i7 t2 ]8 s: _$ X* d# C& I' Q
  722.   attr_accessor number_proc
    , P3 y  I" B( I# U! w
  723.   attr_accessor index_proc" Q' H# ?5 \$ F; I
  724.   attr_accessor close_proc: i1 }' j! o* w, u  C
  725.   attr_accessor refresh_proc5 `) r0 {' x) @) g/ [- c; y
  726.   attr_accessor number
    5 e3 o1 I' ^5 U( t8 }
  727.   attr_accessor digits_max
    1 w0 s) ~. B& C2 a# }
  728.   attr_accessor variable_id
    ; f' t4 a4 C+ \/ k# R0 V
  729.   #--------------------------------------------------------------------------# Y( f5 \: i( J+ `% t; d0 ]& n4 N
  730.   # ● 数字表. F5 j5 D( F8 b8 }
  731.   #--------------------------------------------------------------------------
    . D. ?; ~$ Z0 b6 ^6 a
  732.   TABLE = [  7,  8,  9,, a6 _" Q; e; {) ^5 e
  733.              4,  5,  6,: ]4 m& T2 j" `
  734.              1,  2,  3,
    ; p5 W2 e& D, j0 q! R
  735.             '←',0,'确定',]
    ; z; o3 D- H8 S& [
  736.   #--------------------------------------------------------------------------
    5 _- v: M/ m& y. `. L; }+ A
  737.   # ● 初始化对象
    ; G' G/ [3 h; F: |" S: ^( e' o
  738.   #--------------------------------------------------------------------------& ?1 K; y) i; l! j
  739.   def initialize( m! k& T/ W+ w- \9 \; \) M" `
  740.     super(0, 0, 120, fitting_height(4))& @3 W* M6 c6 x  C- Z1 J& m/ l  j
  741.     self.openness = 04 G' t/ p& J; {7 M1 Y, k
  742.     @index = 0
    ' V9 l6 I* l3 h& T9 g  k: x6 x% o
  743.     @number = 0
    0 t! p+ o. b! t1 |
  744.     @old_window_index = 0
    ! `. H3 D1 s; E* E- _2 V9 F
  745.     @digits_max = 0- X* b% j1 Q. E
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }$ v8 A: _: G+ f7 R& C
  747.   end) {' w* `/ @% Y7 \+ Y& R+ X
  748.   #--------------------------------------------------------------------------
    ' Y  j$ n1 W' N) p( p. O
  749.   # ● 获取项目的绘制矩形* x1 u$ N3 u9 C2 @' f" P
  750.   #--------------------------------------------------------------------------6 n; a5 p5 u+ L5 f
  751.   def item_rect(index)
    : C+ K+ |5 i. O1 q2 ?
  752.     rect = Rect.new6 }7 U3 c0 z+ d# y1 R; \: Q, r
  753.     rect.x = index % 3  32; w$ C5 Z9 q8 X0 b
  754.     rect.y = index  3  line_height
    1 x& A9 v# C: V5 H# o' r8 K
  755.     rect.width = 32
    7 f1 j0 O% j& O; j# S) ^
  756.     rect.height = line_height1 p/ O4 q' J3 ~* o: j$ C5 o/ b* r) Z
  757.     return rect
    3 o. Z5 B0 M/ T0 f
  758.   end
    - W7 ]3 |0 X$ q5 J+ E
  759.   #--------------------------------------------------------------------------
    : }" t4 p# r. ?6 D& a% j
  760.   # ● 将光标设置到鼠标所在的位置& `: l& w' G0 f
  761.   #--------------------------------------------------------------------------
    ) U; n& [# X5 a
  762.   def set_cursor
    % U. f( [' j/ j. s! b( I0 ]! L
  763.     mouse_row, mouse_col = mouse_window_area* g7 i  I3 x# U. D* t
  764.     if mouse_row = 0 && mouse_col = 0
    # z: {: G5 H  E/ \! g* _  X
  765.       new_index = mouse_row  3 + mouse_col
    % W6 F3 p2 _; F3 {0 C: l7 p
  766.       select(new_index) if new_index = 11# c% z8 Z6 |& {7 P- ]( {) n% L# L
  767.     end
    / h8 Q0 W1 K' y2 O
  768.   end) H% V9 o. g7 v* C
  769.   #--------------------------------------------------------------------------
    # s5 l- z4 D* p% d3 V# ]
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列" `3 P, ^( |  x' X& j1 n6 v
  771.   #--------------------------------------------------------------------------+ r+ [7 k( X) c6 M1 V
  772.   def mouse_window_area$ ?! f' _2 Q  m, g3 G
  773.     if viewport.nil
    : _& W$ E) l& W3 A
  774.       vp_x, vp_y = 0, 0! Q5 [. d; h9 i9 A
  775.     else
      O- _" V6 o5 L! h
  776.       vp_x = viewport.rect.x - viewport.ox
    . w( \" l" q5 P
  777.       vp_y = viewport.rect.y - viewport.oy' t/ n* k# u- O: U& N1 X
  778.     end( J  [1 d( x; b  s% h8 Z
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    8 e9 B- }5 L6 o9 E' d) l1 |
  780.     item_x1 = vp_x + x + standard_padding
    ! q! {* D+ @9 c' b1 y  V! ]
  781.     item_y1 = vp_y + y + standard_padding
    - X$ ^* N/ {1 ?- \5 d; |
  782.     item_x2 = vp_x + x - standard_padding + width
    9 b) ]8 q8 v+ _$ U4 i
  783.     item_y2 = vp_y + y - standard_padding + height' ]! B/ G! I6 ], y
  784.     if mouse_x  item_x12 r( X) {. E' M! g5 _: d/ F, ]- C" \
  785.       mouse_col = -1" {' ]- ?: S+ }# x
  786.     elsif mouse_x  item_x2
    4 K6 V& i2 M1 ^
  787.       mouse_col = -2
    2 B* w- l* V% k" e- v& {- W
  788.     else$ n& D  ~& U  e# S. t* y! ]
  789.       mouse_col = (mouse_x - item_x1)  32
    . q: C1 W+ b+ p
  790.     end
    3 M+ ]5 ?* K' T5 n) p
  791.     if mouse_y  item_y1  d( J( W0 r$ {$ H4 ^- B5 U
  792.       mouse_row = -1
    / o9 W" `6 b$ H8 I
  793.     elsif mouse_y  item_y2
    - \. n0 G4 ?' l* g9 _
  794.       mouse_row = -2# w6 }3 g, \& \( x  }7 [
  795.     else2 H; ?7 y6 |4 e' O
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1), y$ H5 |4 n5 o. y
  797.     end$ H( N5 [% H7 k9 ?$ ?/ t0 _
  798.     return mouse_row, mouse_col
    1 ~5 U* o' Y. H8 F) \
  799.   end
    ) R# Q& ^  P( b6 j" ?% R! H9 t6 A
  800.   #--------------------------------------------------------------------------
    " M6 y# I' Z* G' x2 `
  801.   # ● 获取文字7 d4 i1 {* n% M
  802.   #--------------------------------------------------------------------------
    ) J0 L6 K% \! [8 ~5 ?
  803.   def get_number
    : ~& T* r. {3 m# `. F
  804.     return false if @index == 9  @index == 11
    / M1 S; O7 Y: S2 f6 N
  805.     return TABLE[@index]% r1 p2 x* L8 S
  806.   end4 h6 H/ Q. m, K  V3 `# m3 G7 v
  807.   #--------------------------------------------------------------------------
    8 Q, k) N' e8 x) O/ x9 g2 w
  808.   # ● 判定光标位置是否在“退格”上
    ) h7 w# h/ I8 d& e3 z) c) Y- ~
  809.   #--------------------------------------------------------------------------# v; D/ K2 {: j' P$ \( P
  810.   def is_delete9 Z2 ]( \/ J1 J' v0 ]% _
  811.     @index == 9
    / B! G3 d0 ?3 h
  812.   end( n1 t8 j3 L# b
  813.   #--------------------------------------------------------------------------4 o; T: e4 e0 P4 ^, d% h* R/ `  ~
  814.   # ● 判定光标位置是否在“确定”上
    + M8 a7 f) K# [( i
  815.   #--------------------------------------------------------------------------
    % Q% d9 O0 |% q1 I* S) O  I
  816.   def is_ok
    # \1 a# O1 G8 S4 m
  817.     @index == 11
    & j& ~& i& N' C# p6 J
  818.   end
    9 d( \5 E$ X& `. B0 b
  819.   #--------------------------------------------------------------------------' T: \/ W( i# z9 ^+ p
  820.   # ● 更新光标( T5 j: ~2 |4 U" h* _! }; |
  821.   #--------------------------------------------------------------------------
    , Q& U+ o. q' B2 m! T
  822.   def update_cursor
    3 D8 n( S/ g! R4 [' a
  823.     cursor_rect.set(item_rect(@index)); f) N4 x1 z8 f! ?, d
  824.   end
    & U& ^, H0 ^, w( C2 ^
  825.   #--------------------------------------------------------------------------8 x6 i4 A: D: M0 f! |) Y& ^6 h
  826.   # ● 判定光标是否可以移动) U2 ^% \- J) u# S- X
  827.   #--------------------------------------------------------------------------
    ' `" D% k/ i1 n4 t5 z1 r
  828.   def cursor_movable
    8 U5 A+ u- x& g& ^  j' }
  829.     active$ f" {( ?  j8 _1 H* G& a4 x
  830.   end$ X( x! v( u/ h" @/ u
  831.   #--------------------------------------------------------------------------- h3 ~3 q  k9 m" w1 n4 R, h) a( c
  832.   # ● 光标向下移动+ J3 Q4 l- b& }8 P! ~* A' D% Z0 F
  833.   #     wrap  允许循环
    " n- U' E" B% |4 {- U# t4 w
  834.   #--------------------------------------------------------------------------
    0 j  k1 f& _" I: U" E3 r
  835.   def cursor_down(wrap)- z  _5 A& u  V8 j) \0 ^+ Z. P1 |
  836.     if @index  9 or wrap" ^  R  L4 d! E& Z8 K
  837.       @index = (index + 3) % 12
    2 v4 E3 i, l% m9 V5 F3 c7 N
  838.     end
    ( }  I' L  T& C$ u5 {1 {1 V6 P
  839.   end
    ; {6 k! \( E0 W. h  S( H! e
  840.   #--------------------------------------------------------------------------( ?( J$ V0 V) |1 K8 X  ~! M
  841.   # ● 光标向上移动
    8 a. M" b5 ~5 s( v
  842.   #     wrap  允许循环7 n: \1 ?) d+ J9 B/ \
  843.   #--------------------------------------------------------------------------, W5 i8 ^% _) O6 ?: p% v. v' q, Z* s
  844.   def cursor_up(wrap)
    " [8 e/ i9 j; Z
  845.     if @index = 3 or wrap& m- f4 z$ o. G+ b
  846.       @index = (index + 9) % 120 P8 Z. f0 \& V" I
  847.     end
    + \- j5 z+ B' p4 _7 Z$ S
  848.   end, d. G$ Z5 Z' Z5 X7 D
  849.   #--------------------------------------------------------------------------
    8 y+ w7 g* v$ u$ d/ c- r- T6 F
  850.   # ● 光标向右移动6 z  f& I0 g: a# ?
  851.   #     wrap  允许循环9 z5 G+ Q' P1 z6 D$ [2 ?' }
  852.   #--------------------------------------------------------------------------7 L% C  p+ G. Y4 ^0 E
  853.   def cursor_right(wrap)+ i' a3 F! s& U/ j) ?! ~0 n
  854.     if @index % 3  2) ~' X5 c: l" M$ R" ?( z# y5 ~
  855.       @index += 1
    4 w4 b& v* [/ ?: p
  856.     elsif wrap
    & g: @5 b5 [# g! U0 \% X. r
  857.       @index -= 26 ]* W5 O& f8 ?4 [3 f
  858.     end
    1 b: W' M+ ~& y8 K: K* \
  859.   end
    , h# q& g/ m/ y" ~+ S8 g, f3 H1 y: a  O
  860.   #--------------------------------------------------------------------------( R( G( e9 `7 q6 T: u5 P
  861.   # ● 光标向左移动* d  d  p; W- }0 Y  A' u5 |
  862.   #     wrap  允许循环
    9 V5 o- n. Z- A9 F) X' c
  863.   #--------------------------------------------------------------------------7 u7 v7 ?( Y2 U, C+ U
  864.   def cursor_left(wrap)
    ( m, k4 Y$ J& Z
  865.     if @index % 3  0
    , @9 [0 h) p' Z- j/ K3 g5 K- j+ C
  866.       @index -= 1; S2 B: P- i% C3 x2 J  r
  867.     elsif wrap
    + u, ?# E7 \8 m4 s; v
  868.       @index += 20 c+ H( d! @2 M9 Y% v/ m$ ?( }
  869.     end
    3 d- ]4 L5 o+ @/ |" ^0 T- S( o
  870.   end
    7 C4 g! I: h0 {: F9 @
  871.   #--------------------------------------------------------------------------
    % }) T  ~0 q" E! z  _9 Y0 l4 L; a
  872.   # ● 处理光标的移动
    * F% U3 e. R3 V& [- e
  873.   #--------------------------------------------------------------------------+ p5 y% o/ p9 w0 N4 R) r
  874.   def process_cursor_move
    $ a$ q. x5 ?- k- l; s
  875.     super, E9 P- q4 E- E4 X! |
  876.     update_cursor
    $ r% _4 {/ s0 L3 J
  877.   end9 `8 Q6 z1 a5 N* t( @
  878.   #--------------------------------------------------------------------------# {' }% I' k8 D2 Z+ \
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    + e) s  S& S- W/ o$ d+ n9 U8 `9 d9 E
  880.   #--------------------------------------------------------------------------
    3 Z$ ?# T5 R3 @& B
  881.   def process_handling
    2 E9 ?9 @( Y1 W. J  f/ _5 u: c# _
  882.     return unless open && active8 F1 X, f$ t; u: i$ a2 G. z
  883.     process_jump if Input.trigger(A)5 w5 e2 o- ?, f, z7 b
  884.     process_back if Input.repeat(B)1 q8 V, M- _0 K. \7 ^: K
  885.     process_ok   if Input.trigger(C)
    - k. ~7 l! _, C8 ~: q% {; |
  886.   end% J% p8 s& b. @- M0 Y8 R3 Z$ W
  887.   #--------------------------------------------------------------------------
    9 p, N2 P3 n7 E' w
  888.   # ● 跳转“确定”
    : s3 @! ^" S& V& T2 {5 g
  889.   #--------------------------------------------------------------------------
    3 x! e" r' W3 E: ~8 M' o
  890.   def process_jump
    & \# I7 O/ m4 B/ B
  891.     if @index != 11
    4 Q% k  c6 G" S) g
  892.       @index = 112 C) c6 B/ |. r+ a; Q, Y) e0 ?
  893.       Sound.play_cursor
    5 `8 m! Z! q* h! P- ~2 N
  894.     end
    0 a2 e, ]. t9 T
  895.   end, q# t! e6 y" i1 Q- ?
  896.   #--------------------------------------------------------------------------  r7 J- n% Z* B
  897.   # ● 后退一个字符7 |  n5 {( x1 W
  898.   #--------------------------------------------------------------------------% T! O$ N# y+ x/ _, `! J
  899.   def process_back
    ; J! x5 j' o1 p0 z0 O/ ?2 }
  900.     Sound.play_cancel
    ( _. p2 t9 {8 }" _4 N7 a
  901.     place = 10  (@digits_max - 1 - @old_window_index)( b5 x! E& i* K* {1 a# z- R
  902.     n = (@number  place) % 10
    & V- B1 G# c; }
  903.     @number -= n  place
    * {6 j5 ^8 Y. [; |0 f' r0 {# H
  904.     @number_proc.call(@number)" y8 }/ E8 c( L- g( `
  905.     @old_window_index -= 1 if @old_window_index  05 x& T1 ]: l" j& g4 K5 Q
  906.     @index_proc.call(@old_window_index)
    0 F% b7 h2 T- c
  907.     @refresh_proc.call
    . n3 h) f4 n: x0 r6 [6 J9 `: g  v( U9 I8 ?
  908.   end
    ! X$ _$ Y- h3 V
  909.   #--------------------------------------------------------------------------/ N$ V* B+ B: Y, }+ q0 C
  910.   # ● 按下确定键时的处理" q, y5 t+ z( }: g- `$ `
  911.   #--------------------------------------------------------------------------
    3 b9 |+ S8 a) X9 n2 E
  912.   def process_ok0 }- U; s+ X+ a# N, o% q
  913.     if get_number( R4 W6 m$ p/ u' t0 r5 `& A
  914.       Sound.play_cursor1 n# b& c. @) o' n
  915.       place = 10  (@digits_max - 1 - @old_window_index)0 `& m" K/ C- ~
  916.       n = get_number - (@number  place) % 10
    + y( g$ _9 J  S1 q0 v/ ]
  917.       @number += n  place! w3 d4 ^4 y  {+ o: c0 R7 S
  918.       @number_proc.call(@number)  z7 c. @9 E6 O  C( U- t5 K9 f
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    ) W; F* S% b1 m2 d3 h
  920.       @index_proc.call(@old_window_index)
    + L8 D, N. _( E# \& N5 U3 f
  921.       @refresh_proc.call
    : ~5 m/ _4 l8 p; d! Y- g2 G
  922.     elsif is_delete' E+ E% ^8 }3 e& g+ z- r  K  r
  923.       process_back2 }' k6 ^. f* Y# M
  924.     elsif is_ok
    3 n* r2 G* o* o/ P; v
  925.       on_input_ok  ^* b0 Z) t+ e6 k/ Q
  926.     end  ]* r- h6 E# n9 R. B4 A6 e) ]
  927.   end" s9 h: m& B1 X, i" d& L( b9 E
  928.   #--------------------------------------------------------------------------. ]5 a$ [* K  P4 R9 _
  929.   # ● 确定- K* b7 r; E9 R- ]
  930.   #--------------------------------------------------------------------------+ h! ]7 s# j- m0 \1 K
  931.   def on_input_ok
    & u8 Z3 F8 e/ R5 M  P' F
  932.     @index = 0
    $ {7 F4 K4 e3 X
  933.     @old_window_index = 0
    , Q1 e* L8 W# l" v
  934.     $game_variables[@variable_id] = @number% y- P. `$ @4 _% [/ {0 {$ A5 h' A
  935.     Sound.play_ok
    7 s6 Y- c& Y6 F! A6 L# V
  936.     @close_proc.call, f+ A$ c. n7 a% \
  937.   end
    8 F1 O- n, y. }; g$ B; Y
  938.   #--------------------------------------------------------------------------% s: h. T# x# G4 D/ s
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, V. i/ ]. l" O. G- ^% z" t1 x
  940.   #--------------------------------------------------------------------------
    0 w- D4 ^; {% K1 L$ b
  941.   def set_mouse_pos9 g& T8 G' o- ^6 D, C; P
  942.     if viewport.nil # necessary!
    4 j; g6 B7 i) F/ d# D- H
  943.       vp_x, vp_y = 0, 0
    7 J1 a, r) v& ~  j1 d+ Q: K# E
  944.     else
    ; X( F  N  i( F# t
  945.       vp_x = viewport.rect.x - viewport.ox
    8 q$ g6 ]1 w' J
  946.       vp_y = viewport.rect.y - viewport.oy- M; o5 \! C# I5 ~" b7 }  d
  947.     end$ ^! q; p" U& g' J+ p
  948.     item_x1 = vp_x + x + standard_padding
    8 k  V5 m' `& A! Y" I0 J. I: ^
  949.     item_y1 = vp_y + y + standard_padding
    ) |7 K- g* Y! `- J
  950.     get_index = @index  0  0  @index : V7 B. r5 m9 X' ?
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)& O# A3 _/ n, w2 @4 E% ]
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    3 v9 i5 w  F0 R3 ]4 }
  953.     Mouse.set_mouse_pos(new_x, new_y)
    . G2 [2 v2 f. o5 i
  954.   end9 A3 t6 ?/ q5 Q' P& [) l1 g0 Z, M
  955. end, W3 i+ a& ^- u( K5 ^
  956. , ?; b' @! z8 N3 O
  957. #==============================================================================
    5 i4 A; H; ?- R2 M, e# s
  958. # ■ Window_Message' d2 f9 f6 j8 |
  959. #------------------------------------------------------------------------------; X+ I- R' b+ g# [3 g" g
  960. #  显示文字信息的窗口。. r7 ]+ Y; A9 x
  961. #==============================================================================# D* d+ d% c' [( m+ J$ X+ Y: H: V
  962. class Window_Message  Window_Base; ]1 ]8 q* U+ W& K1 G
  963.   #--------------------------------------------------------------------------
    ' S* Y- V9 P& g) d: D" l5 K$ [1 M
  964.   # ● 处理数值的输入(覆盖原方法)
    . @9 {4 ?, q. X) Z
  965.   #--------------------------------------------------------------------------# D# L1 Y  O6 p6 K, [
  966.   def input_number1 X6 a) P3 j  t+ i. e! ~+ m
  967.     @number_window.start, ]5 p' D: y/ D+ k6 p. k( t
  968.     Fiber.yield while @number_window.extra_window.active9 L$ k! P  z2 O4 x* G
  969.   end0 [* X9 I. ~6 N
  970. end3 U& t' Z8 f3 M0 u* V5 w" x

  971. , b' b/ E0 T$ ~7 V2 ?
  972. #==============================================================================2 v+ U6 R: j6 f0 S; d
  973. # ■ Window_PartyCommand
    - Q' ?7 L9 D! \  m( s
  974. #------------------------------------------------------------------------------
      \( b/ ^' U! y* N; r
  975. #  战斗画面中,选择“战斗/撤退”的窗口。: s0 K' y' C& F* W( O
  976. #==============================================================================
    / x, }6 c' f) s% H2 g1 k
  977. class Window_PartyCommand  Window_Command
    ; x0 R- y$ O- J, Q) z: j
  978.   #--------------------------------------------------------------------------
    $ ~- I* e" K& G  M
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置0 k# B: B! [8 r9 h
  980.   #--------------------------------------------------------------------------
    + ]  b' S$ Y% g$ \: t
  981.   def set_mouse_pos0 o# O3 {+ X" D" S( a5 z+ G
  982.     if viewport.nil
    , b+ |4 @2 G( w0 ]+ T
  983.       vp_x, vp_y = 0, 0
    : j+ W( y; f. l* M5 j' M/ ^. j
  984.     else
    # J4 F/ M7 z8 m& `+ r- P
  985.       #vp_x = viewport.rect.x - viewport.ox) K* o/ N! o( ~( n/ l
  986.       vp_y = viewport.rect.y - viewport.oy
    4 O2 D: |0 q) }/ m: l1 B8 @4 D( y3 U
  987.     end5 ~, l  c5 U- @
  988.     item_x1 = x + standard_padding
    # Y7 v1 C, P) D
  989.     item_y1 = vp_y + y + standard_padding9 Z0 c0 f6 b! p
  990.     get_index = @index  0  0  @index
    " ^; q; m8 v6 t$ T  ?$ ]5 A
  991.     row = get_index  col_max - top_row4 N! R9 H. p1 y8 {
  992.     col = get_index % col_max" A+ }, B$ z& g8 A
  993.     new_x = item_x1 + item_width  (col + 0.5)6 c. I. S! z& [
  994.     new_y = item_y1 + item_height  (row + 0.5)+ w8 L1 L; a& u8 }) _, ]
  995.     Mouse.set_mouse_pos(new_x, new_y)
    + P  w, C( a6 W6 x4 z
  996.   end
    / }( ?5 Z. c1 k# ^: P: H6 n
  997. end
    / s) s- K# L& j' }
  998. $ t" y) _' C4 M$ s8 q
  999. #==============================================================================
    0 Y, _! q% Q1 c7 m  }
  1000. # ■ Window_ActorCommand1 _- M; D2 `& P/ ~2 i6 Y  k: N
  1001. #------------------------------------------------------------------------------
    $ ]! @& p4 k# k7 y( W; w# o9 \
  1002. #  战斗画面中,选择角色行动的窗口。5 s3 F' ~* b' s- H* l
  1003. #==============================================================================/ P* x- ~5 k( o8 x, q
  1004. class Window_ActorCommand  Window_Command! X' M. q6 Y: o1 T; ~7 N, A% D: j
  1005.   #--------------------------------------------------------------------------
    ) q: s, b9 d5 S; q! X1 f1 q
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    1 ^- _8 ^' J$ F. T7 l4 y# T
  1007.   #--------------------------------------------------------------------------
    ) {) H$ K  _# @8 u
  1008.   def set_mouse_pos, i4 E" l" f) \) p- s
  1009.     if viewport.nil
    " _0 ^  t) l- u  J; d- ?
  1010.       vp_x, vp_y = 0, 01 s1 G) V& Z7 _+ r% z
  1011.     else
    / q, ?1 e" D0 u0 Q+ z& U2 N+ V4 k
  1012.       #vp_x = viewport.rect.x - viewport.ox
    6 ~' M4 v# O* m2 P# k! p& o9 s
  1013.       vp_y = viewport.rect.y - viewport.oy) q, b/ ?2 ]0 S5 n0 X
  1014.     end! S% ~. _- _% t/ F" J' w
  1015.     item_x1 = Graphics.width - width + standard_padding
    $ C) I5 w( }0 ]! Z* R9 p
  1016.     item_y1 = vp_y + y + standard_padding
    ) }8 J+ w. j/ f' M8 `3 d
  1017.     get_index = @index  0  0  @index " U8 F6 B% ~: M& l# N) d5 z/ n9 X8 y3 v
  1018.     row = get_index  col_max - top_row
    0 M9 E8 e9 _, i7 A  W3 y( `  s; G( h0 M
  1019.     col = get_index % col_max3 J, k, ]* |/ Y  C9 q& U
  1020.     new_x = item_x1 + item_width  (col + 0.5)! D/ r  {, M  O1 S. y/ _6 M: M
  1021.     new_y = item_y1 + item_height  (row + 0.5)' w2 H2 a* k8 ?) z  B( k
  1022.     Mouse.set_mouse_pos(new_x, new_y)
    7 m- e" p& D8 n9 o* j: v
  1023.   end
    9 i- L1 ^2 x1 k6 ?+ v
  1024. end" T$ f- @/ i- ?3 }

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

  2145. & D: o; R6 U/ B+ Z. Q9 e
  2146. #==============================================================================
    * k, j$ i7 A+ z
  2147. # ■ Game_Map
    . V( }( t4 I3 V
  2148. #------------------------------------------------------------------------------7 D, w  I0 ?6 w5 c$ g
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。/ f% l0 [% o7 I$ }" ]( q; c3 K9 P, E
  2150. #   本类的实例请参考 $game_map 。$ c" c+ ?7 N, x* y, n: L% T' C
  2151. #==============================================================================
    . c6 ]7 _- M7 S  U
  2152. class Game_Map
    ! s; {. v. C. Y* w6 T
  2153.   #--------------------------------------------------------------------------- L- ~- F7 ^& C9 Y  p' d
  2154.   # ● 定义实例变量4 [! h3 ~1 v3 w
  2155.   #--------------------------------------------------------------------------) Q2 e2 M' G( m4 F+ t7 a3 i
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
    + r" \; S  O! z$ r% g
  2157.   attr_reader mouse_map_y # 同上4 m3 d" V9 Y# i- Z. v
  2158.   #--------------------------------------------------------------------------
    : }: {3 e% _- D1 s* Q
  2159.   # ● 初始化对象
    2 W$ ?' e1 R1 M$ T' B
  2160.   #--------------------------------------------------------------------------
    & V3 v1 t6 e! P3 M( C5 u
  2161.   alias sion_mouse_initialize initialize, v, q# T0 h0 h; d4 n0 G
  2162.   def initialize: Z: w9 A. ~4 }) ^( d3 f) t: q' v
  2163.     sion_mouse_initialize8 \% T) U8 V9 I/ i
  2164.     creat_move_sign  ###
    0 u( Z; ^* g/ h$ K0 @
  2165.     set_constants) }8 V2 e8 o0 D9 ~5 _
  2166.   end
    ! Y7 g# W5 ?, h/ s3 p, I
  2167.   #--------------------------------------------------------------------------6 n. ~3 @+ S$ ~5 E! E! _7 u7 G
  2168.   # ● 更新画面
    5 K% G. b9 k- @6 y. L
  2169.   #     main  事件解释器更新的标志; ~$ x, k% R5 b/ k+ I( P6 Y( b
  2170.   #--------------------------------------------------------------------------- {4 f4 b9 L8 E3 o  b! ]" B
  2171.   alias sion_mouse_update update
    - ]7 H# o1 H* D/ q4 N6 F
  2172.   def update(main = false)4 W- @/ O% ?  N1 ~: B
  2173.     sion_mouse_update(main)) `  a4 t5 M8 \. s1 @4 r
  2174.     update_move_sign( O1 H# Z% n9 m5 V8 p
  2175.   end1 ^) T7 y+ x6 V% s5 x; m  X! w# G+ o
  2176.   #--------------------------------------------------------------------------
    6 {: U( w4 h. s' l9 v
  2177.   # ● 创建显示路径点的事件  X2 [5 X* y  q+ X- Z7 p
  2178.   #--------------------------------------------------------------------------
    % c: z' N$ Z9 e& Y' v; S
  2179.   def creat_move_sign
    9 e5 ]; e6 D% A2 g- d7 \
  2180.     $mouse_move_sign = Move_Sign.new
    " i. ]( P- c/ [8 `/ O* w9 h+ v
  2181.   end
    ( Z; p/ L5 [$ \( k% H9 b
  2182.   #--------------------------------------------------------------------------  e/ f& I) n1 j/ Z2 R! r
  2183.   # ● 更新显示路径点的事件
    . O9 v; p1 K  ^
  2184.   #--------------------------------------------------------------------------
    $ X; _9 c% s$ E: |
  2185.   def set_constants
      c4 T7 Y; @0 i
  2186.     @mouse_pos_setted = true
    2 @" a) v: F: }# `2 b  z9 P
  2187.     @set_pos_prepared = false! |+ S) B3 G0 `/ j$ L: w- u
  2188.     @mouse_old_x = 0: B: J' S6 C' }& m, ]6 z  m6 j' w* D
  2189.     @mouse_old_y = 04 M0 i& a* G7 W/ a3 }
  2190.   end) n7 `+ D9 j2 s! L3 I" _! B
  2191.   #--------------------------------------------------------------------------' p7 t  q8 s5 N
  2192.   # ● 更新显示路径点的事件
    4 `) a* v% A6 I' T% o9 u
  2193.   #--------------------------------------------------------------------------" g; C$ Q2 `1 ]' U- M' n# j
  2194.   def update_move_sign
    : V9 [* B4 `, Y1 K& L
  2195.     $mouse_move_sign.update
    / J  O" _- \$ [# p4 D0 u' U3 |
  2196.   end
    ( G# [  h) ^% j6 @9 Q
  2197.   #--------------------------------------------------------------------------
    & r1 j- w3 w. C+ u- Z; e+ E
  2198.   # ● 获取鼠标位于的地图块的x、y坐标  V2 ~1 s  q* g7 @9 r
  2199.   #--------------------------------------------------------------------------5 \2 s$ J* Y. p9 z; _% e8 F4 y
  2200.   def get_mouse_map_xy
    2 z; k; L' ?0 @! X. T7 O
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    3 _# B% Y% K2 w3 x5 w* d4 Q
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)2 e+ h5 T) A+ O" |8 a
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    ) j2 J( B- o7 k# g! \9 D5 ?; ]6 |
  2204.   end" C6 ]' s' X% d) m' P" Q
  2205.   #--------------------------------------------------------------------------5 Y9 d2 A0 p; G/ ]' V" w! p, F+ E0 I  T
  2206.   # ● 返回地图画面时重设鼠标坐标9 i' L1 T8 M6 j* i' c3 b9 ~5 Z" W
  2207.   #--------------------------------------------------------------------------  j6 q! G+ w0 ]6 W
  2208.   def reset_mouse_pos; f3 }( P$ W  _
  2209.     return if @mouse_pos_setted
    . D( a; J  ^# Z0 {' ?
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    " l0 d8 z7 }4 _. s( ?7 b: g
  2211.     @mouse_pos_setted = true
    + a0 ?  m, l* b
  2212.     @set_pos_prepared = false
    ! o' \' ^7 U( K
  2213.   end! T: }8 r4 g2 b' u9 }  i
  2214.   #--------------------------------------------------------------------------
    6 X: M1 X9 _4 z8 U& z! t/ S6 K7 ^
  2215.   # ● 重设鼠标的坐标8 X" T6 ~5 X* h
  2216.   #--------------------------------------------------------------------------
    . \) G1 Y( }1 V" i' [  V" N: `
  2217.   def prepare_reset_mouse_pos
    . c9 l: q0 K1 r3 ?! C( o+ ~
  2218.     return if @set_pos_prepared
    * G8 W( H6 F* h# W; c# [2 R  Y$ a3 }: l
  2219.     @mouse_pos_setted = false
    : D- q, X4 m; H
  2220.     @mouse_old_x = Mouse.mouse_x# Y, D5 L! l" [4 y
  2221.     @mouse_old_y = Mouse.mouse_y
    * t) l# ~2 E% T1 W% q9 O6 R
  2222.     @set_pos_prepared = true  j9 `/ V; \+ `& ^6 X% z
  2223.   end
    % e( m# U! K* W  N( Q# c) [
  2224. end
    # L7 V7 A! @6 P$ D4 \3 i

  2225. 5 G$ q( g$ a( _5 a/ a# O, B
  2226. #==============================================================================
    2 l0 ?' q) V* V5 E" J! h9 A
  2227. # ■ Spriteset_Map
    ! V% I6 O# z; n7 o
  2228. #------------------------------------------------------------------------------
    3 ?6 \. l3 R6 j7 _- g: C/ H
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    $ W. q% A2 B* r! ~. }4 ]
  2230. #==============================================================================
    0 i+ Z( |) _' E, Z
  2231. class Spriteset_Map" o" o/ d0 P& Y$ ~- W5 }
  2232.   #--------------------------------------------------------------------------
    9 k/ q+ V0 t3 u7 R/ A
  2233.   # ● 生成路径点精灵
    4 p5 e; \% O" q, n
  2234.   #--------------------------------------------------------------------------
    4 O4 u) x5 C0 I8 H9 {" N" v3 F
  2235.   alias sion_mouse_create_characters create_characters
    4 w0 @4 V+ t' d* ]$ S! ]$ A" F$ B
  2236.   def create_characters
    7 F& J5 z' G: S( V% X
  2237.     sion_mouse_create_characters
    6 `0 c- |5 B9 M! f1 ]
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))1 e6 S( L, j/ @: d1 j- a
  2239.   end
    6 }1 Y9 A; y* H9 `' A. {2 p
  2240. end+ _  d$ y* \4 H

  2241. ; Q( n2 L2 g8 K* z0 `
  2242. #==============================================================================
    - r- A! |& a  T. m* G# d
  2243. # ■ Scene_Map" @, O: ^! h* u5 Y5 L1 e) z
  2244. #------------------------------------------------------------------------------- f5 x+ f" \  e6 q% f  J' j
  2245. #  地图画面
    ' O' P8 W  d0 U. W* j
  2246. #==============================================================================
    / b$ s0 P, P! C9 A. P
  2247. class Scene_Map  Scene_Base2 x' m& W' u3 M  t
  2248.   #--------------------------------------------------------------------------( z# W% P' {& Z' ^! |* H' Z$ ?
  2249.   # ● 画面更新; A5 C. I5 O0 N# L
  2250.   #--------------------------------------------------------------------------9 N4 ]! s+ b& I
  2251.   alias sion_mouse_update_scene update_scene/ [5 w. L. ~" P
  2252.   def update_scene
    7 g* J7 Q: H3 q! x
  2253.     sion_mouse_update_scene
    % [9 Q7 F* g' [6 e
  2254.     update_mouse_action unless scene_changing* F$ [7 U3 B9 ^5 a1 w0 H
  2255.   end
      y3 w: X1 k' E& C( w! J
  2256.   #--------------------------------------------------------------------------
    % T8 e$ m) c3 m( e9 d& |9 l
  2257.   # ● 场所移动前的处理
    4 e" z7 y( ^1 T# W. Z5 [) v
  2258.   #--------------------------------------------------------------------------" w! a# Y6 v1 n: Z7 }
  2259.   alias sion_mouse_pre_transfer pre_transfer) N7 W, V6 A) K6 `: o
  2260.   def pre_transfer; K  N4 P# u  v5 W2 i( e
  2261.     $game_player.reset_move_path
    3 U) S+ j) B0 P2 o" i# W8 [+ s
  2262.     sion_mouse_pre_transfer
    ) x0 |$ M  }5 B) J% E, l9 [; A
  2263.   end2 T5 k* G/ x) U$ X1 A: C$ u" |
  2264.   #--------------------------------------------------------------------------
    " n' |  L) ^6 Z7 a
  2265.   # ● 监听鼠标左键的按下% ]5 c0 O! _9 O+ r
  2266.   #--------------------------------------------------------------------------7 V7 |8 z( B2 d! p. b8 D3 {/ A4 G
  2267.   def update_mouse_action
    1 ?4 y# ]/ R$ M0 J
  2268.     $game_player.left_button_action if Mouse.press(0x01)' d  n7 q( t0 K8 y# C; U6 M# w- X
  2269.   end* }1 q' V7 s+ I
  2270. end
    + C) @0 y4 n3 W2 C* C* o. i, a/ x0 x

  2271. 8 D% q, X$ _  O9 |" y6 k% G8 I
  2272. #==============================================================================
    " `+ [! l/ S4 g/ q1 m1 ^
  2273. # ■ Scene_File
    # q- G2 t6 U4 e$ n
  2274. #------------------------------------------------------------------------------
    4 t4 ?& L  t2 ~
  2275. #  存档画面和读档画面共同的父类/ |, ^2 E  U! P0 x1 b$ T8 V8 M
  2276. #==============================================================================/ c3 o# L5 q$ X# h9 L; G/ e  N
  2277. class Scene_File  Scene_MenuBase
    0 P: H. B+ l9 S. S; H, Q
  2278.   #--------------------------------------------------------------------------, D3 ^4 X3 M- A. T# \, v# V
  2279.   # ● 开始处理
    * M( k3 e4 o' ?. f; O% \/ F/ F
  2280.   #--------------------------------------------------------------------------5 M/ _/ {, m# s5 ^: V, @3 E
  2281.   alias sion_mouse_start start; L$ W/ y8 ?% u: T3 b
  2282.   def start0 a% P1 F/ H& ]" _
  2283.     sion_mouse_start1 `# {. }! m+ G  O# q3 O8 e
  2284.     @move_state = 0
    : E; f% |! f5 k  G
  2285.     set_mouse_pos' V* r! }# W7 S; Y+ H+ q* Z
  2286.   end. {; A) x& r) [9 ^8 |; g* O# C  S
  2287.   #--------------------------------------------------------------------------
    " h' D) K4 ^) d' U
  2288.   # ● 更新画面' P( Y9 ^; L1 t
  2289.   #--------------------------------------------------------------------------
      U( Q7 T0 {9 d  ^# j9 Q* S3 c
  2290.   alias sion_mouse_update update$ P7 D& h" f# H0 x) d% K! S" n) k2 y
  2291.   def update  k* _: F9 K, j7 B6 U
  2292.     sion_mouse_update
    , ]1 u- \! [1 Z5 U9 n3 J, \' k0 H1 b3 [
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos0 \# F* g- r1 w) @6 G1 D6 A" F6 j
  2294.   end1 q" B, s1 Y) O3 y/ g6 Y
  2295.   #--------------------------------------------------------------------------
    0 l9 g3 r& T, N: k5 r$ F, k! _% X; O
  2296.   # ● 更新光标: y) y9 m2 o9 q" e' y2 j) k
  2297.   #--------------------------------------------------------------------------% B& n' x3 a) G2 U
  2298.   def set_cursor
    9 V- y; F4 b" Q0 c- U6 _) v) `
  2299.     @move_state += 1
    ( g6 f+ n* V! X( W$ ]- s
  2300.     last_index = @index
    ) Q# e) f! s' x5 h
  2301.     if mouse_which_window == -2
    4 g; F# j2 X  ~* P& I& G' I2 O
  2302.       if (@move_state - 1) % 6 == 0' K& m' }+ d. d, F
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    6 K0 I; r" f* l6 o/ U
  2304.       end
    6 m# T/ z4 S, r( p' W. {8 i
  2305.     elsif mouse_which_window == -1$ ]. K8 L" c: J3 d, N- u- m! t# n
  2306.       if (@move_state - 1) % 6 == 0
    ( U# V9 G* S6 t" P- V
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0# V4 }9 f/ i+ \) E3 M, B5 K
  2308.       end
    : U* Z" e1 ^+ E" f- A4 f  g% K7 f
  2309.     else
    / ?6 f5 w3 I9 K* ?  B2 Q! j+ ?5 g
  2310.       @move_state = 0- u1 P/ A6 p2 r
  2311.       @index = top_index + mouse_which_window
    % G7 x; y+ f# |
  2312.     end
    1 z% N# W. `5 R7 N4 @+ r, _
  2313.     ensure_cursor_visible
    " P. D; |2 ^' L) I8 T% L0 a
  2314.     if @index != last_index2 n3 p/ }$ n. t* N; W; Z7 B
  2315.       @savefile_windows[last_index].selected = false
      X) {# m, q9 s* E0 q0 e
  2316.       @savefile_windows[@index].selected = true/ b& d/ @+ I$ n+ W4 c8 f" u2 m
  2317.     end, R( X9 K# h0 @) |- l, W5 \
  2318.   end- \: C8 ?1 O3 I5 W$ r
  2319.   #--------------------------------------------------------------------------7 j: N: p, r; Z1 u6 e7 ?; `
  2320.   # ● 判断鼠标位于哪个窗口
    3 H2 Q- a* e% M& K8 k
  2321.   #--------------------------------------------------------------------------. d4 F! M& `$ y3 J" ]! `
  2322.   def mouse_which_window
    1 s( F+ o# M" A  o8 g
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    % G& @: E2 n) E' `& z  o9 a" Y! O2 n6 u
  2324.     if mouse_y  @help_window.height + 147 V; ^& ~3 I4 Z) `; I
  2325.       mouse_row = -1
    4 o4 y5 M. J" h  `
  2326.     elsif mouse_y  Graphics.height - 14
    1 G& w+ A, p1 x! K2 O
  2327.       mouse_row = -2
    . u" K4 |  V! e" }
  2328.     else
    ' i/ c' k' |- u2 w/ N5 x: k
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    : _7 A, i& |, b/ m3 Z0 O4 J
  2330.         (Graphics.height - @help_window.height)1 m1 W* o: v% r1 K6 ~/ b
  2331.     end
    $ K: l/ x3 D8 @. j' [* k# G, B. B
  2332.     return mouse_row
    9 U! `) ~0 Y* Z. u8 F
  2333.   end
    4 B# P4 P7 M4 k# M2 Z
  2334.   #--------------------------------------------------------------------------
    % j/ L+ w$ }8 w- M
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
      p& m+ n& z- `
  2336.   #--------------------------------------------------------------------------- j9 w0 \  b# X4 Z. [) K: L
  2337.   def set_mouse_pos2 g5 |2 K, E9 k& ^: j9 y
  2338.     new_x = 40
    7 M! w- Q9 r9 g9 Z% v$ g+ L' X
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24% j$ }, D$ G) m; w
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    4 x) i3 N. A) F- T1 ~( b
  2341.   end* l/ i9 C. C6 E/ K  j
  2342. end% b, U3 U3 S; F/ F

  2343. 0 O& Y# e; ^, i$ [9 a/ O( |
  2344. #==============================================================================
    ; v' O- ]' g1 x# U) M$ z, W
  2345. # ■ Game_Event5 M7 |. |% C: r' M7 @4 e' x" p
  2346. #------------------------------------------------------------------------------
    4 ^2 U8 _0 j  N  v# N9 h, u
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    0 ^- }$ x; E8 B9 Y
  2348. #   在 Game_Map 类的内部使用。, o( a3 a0 R  m5 i
  2349. #==============================================================================
    - N( P( c' j9 m. Q0 ?
  2350. class Game_Event  Game_Character
    ' B+ A$ l4 [4 o: F3 Y, k# D, C2 G( o7 X
  2351.   #--------------------------------------------------------------------------2 g9 |: |9 T& p- t* A4 [( {- h
  2352.   # ● 事件启动4 i2 o; f! M! \" M: v/ l
  2353.   #--------------------------------------------------------------------------
    ) v2 {3 n. l- ^9 m  f. ?/ m% L
  2354.   alias sion_mouse_start start% {2 E# `: k( D4 v
  2355.   def start( Q9 i7 x) ]) J6 s
  2356.     return if mouse_start && !Mouse.press(0x01)
    2 ?) ~7 ^3 C- P( f3 p
  2357.     sion_mouse_start$ i: d1 q& |# i0 A
  2358.   end
    0 l- W" a- Y, Z5 K
  2359.   #--------------------------------------------------------------------------, ~2 Y( e: b0 W4 ^8 C7 f7 |* F
  2360.   # ● 判断事件是否由鼠标启动
      n. g, Z9 l2 L) p  i) u1 u
  2361.   #--------------------------------------------------------------------------$ ~* c% c7 h& s
  2362.   def mouse_start
    ; T; d8 g( C6 ?1 n9 D
  2363.     return false if empty
    % x: G+ S+ n9 x, k! Q, T
  2364.     @list.each do index
    $ R& A! m' D8 t/ ^3 B/ y; [
  2365.       return true if (index.code == 108  index.code == 408) &&: ^; l8 s: w4 I% K. I. v
  2366.         index.parameters[0].include('鼠标启动')
    3 g' v4 T+ w1 M8 J! V
  2367.     end4 s. ]. M* H' l+ A
  2368.     return false
    2 \+ A7 w) G* s8 C* T9 g7 L( r
  2369.   end
    $ b! G8 P2 I: }& O
  2370. end4 n$ p2 |5 K' P4 I: k) c0 i- @

  2371. / ]) o& T1 J" `+ M# _
  2372. ####泥煤的height8 \: c6 Y! l" m, C8 I; F
  2373. # @height = height& B5 |( b4 i0 D

  2374. 4 I9 p# q3 m1 Z6 o  i2 w& C
  2375. class Area_Response* y7 z. ?% A7 i  p* H
  2376.   attr_accessor type
    0 J0 O" K: E  j& D/ B0 q: e' U4 k
  2377.   attr_reader ox8 m; T5 o+ i) P
  2378.   attr_reader oy
    , ~: t, h  R) H& H8 S2 o
  2379.   attr_reader width$ @" |) u7 a& t) G; J
  2380.   attr_reader height, u3 {1 D/ J, }1 t* Y1 s* ^3 }
  2381.   attr_reader switch_id
    ; C0 X+ Z. Y  d# y
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    % A+ h) l# h8 j, q/ j4 N* Q. W" ?
  2383.     @type = type  K; J/ |5 m( j+ B; f6 P/ t
  2384.     @ox = ox
    ) }2 B& j$ S7 P$ R
  2385.     @oy = oy5 X2 D3 T" Q9 O, Y0 S5 Y
  2386.     @width = width9 B* G& @0 y9 Z; T1 ]! b5 \2 I% G
  2387.     @height = height4 R/ T5 ]/ L3 G( c: y: N$ t, `
  2388.     @switch_id = switch_id! W( T+ v5 K* \% M, x
  2389.   end
    ! }9 E, e! _$ r  t3 J: ~% L
  2390. end
    1 ]5 F% q, a. D

  2391. 8 Z/ X# Q4 g, @. H2 W7 a5 I- ^
  2392. $area_responses = []; Z1 m2 k' T" U6 a. G

  2393. 2 y1 `& l# Y1 i7 s: x: \  |' V1 ^
  2394. class Scene_Map
    ' p& ?# m: e7 o, S
  2395.   alias update_mouse_2013421 update_mouse_action3 H! h0 i. ~3 k, I# x8 n9 K
  2396.   def update_mouse_action9 g* w: B) _$ u* w* S' O
  2397.     update_area_response
    9 z/ r2 t: f$ B4 F- f4 i- g
  2398.     update_mouse_2013421( P% l: l7 @; |5 K) g$ ~* y1 S9 B
  2399.   end
    * O7 J- s, Y9 Y7 @! r( H
  2400.   def update_area_response
    3 O3 w; {4 m' p1 n
  2401.     responses = $area_responses
    " m9 X' n+ t0 a; o& J; `  ]
  2402.     responses.each {response
    ; {2 z0 k$ j9 U3 L+ Z5 m
  2403.       ox = response.ox; [( `$ e6 Y* N+ c
  2404.       oy = response.oy
    7 [: G( V& a5 R& l# I
  2405.       width = response.width
    * q. L1 }. j5 r1 d* {
  2406.       height = response.height
    # Y) [1 O7 T( m6 K# d8 y$ h
  2407.       switch_id = response.switch_id$ u/ }' k0 i) p8 U+ I
  2408.       case response.type; Q9 _( f) A% Q/ c
  2409.       when 0' _- h- ?) @) O1 ]1 T* |- t
  2410.         if mouse_in_area(ox, oy, width, height): V3 J' l( Q$ b
  2411.           $game_switches[switch_id] = true
    ( b6 j0 P( |% m9 H
  2412.           $area_responses.delete(response)
    ! O5 R# v4 F3 U. J2 q2 M1 |$ v: R
  2413.         end
    ! d; S. E+ z$ }
  2414.       when 1
    : ~1 n, H! \9 E. c0 y0 R% N
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    7 d3 ?6 S( n' v- C( B
  2416.           $game_switches[switch_id] = true
    , P( [: _" ~* e7 G
  2417.           $area_responses.delete(response)' o8 k9 L' H! m& U. Y  Z8 l5 S
  2418.         end
    ) W8 I$ w+ y% W% s- B. o
  2419.       when 28 @/ Z( ^! y5 U+ r/ @- ~1 z
  2420.         if mouse_in_area(ox, oy, width, height)
    8 I2 N$ w' y0 V6 ]
  2421.           $game_switches[switch_id] = true9 l* k7 J/ W& Z2 D
  2422.         else, |7 O' W3 {! h5 a* F& B( F
  2423.           $game_switches[switch_id] = false
    9 w) `( p+ R' z7 F, }5 G% Z
  2424.         end
    # z. u6 U. t! L# ?) X- N
  2425.       when 3
    : ^) c( `, G- ~5 k, {" A( K0 ]
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,# x! o7 e( ~  v( p$ o' q3 Y) d
  2427.             (oy - $game_map.display_y)  32, width, height)" G' z- t$ b. ?
  2428.           $game_map.events_xy(ox, oy).each {event& d6 E& M0 z/ e: n0 {5 w3 [
  2429.           event.start
    ' U0 w9 z. A1 {7 c. a
  2430.           $area_responses.delete(response)0 l5 M& w% _5 \; z9 v3 R/ }
  2431.           return6 Y% F( B' e3 @, D" ?8 x7 T8 i% j
  2432.           } 0 F0 V' {( V, N# S( `' b
  2433.         end5 Q) P; w7 d2 s! E% b
  2434.       when 4
    & e# f  X9 q" M5 o2 l, x4 ~
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    7 j8 J5 s' h! e: T
  2436.             (oy - $game_map.display_y)  32, width, height)& Q3 {5 Y9 O9 }
  2437.           $game_map.events_xy(ox, oy).each {event
    9 X3 f" a1 V7 t% R3 U
  2438.             event.start
    ' \0 i# q* V; [# j! A6 U
  2439.             return9 B7 y, o* I3 A: }
  2440.           } 5 r$ G3 [$ a" z- L) t3 O5 D: T
  2441.         end& i8 K* B1 h( P
  2442.       end8 N' @- n, H  Z; }. M
  2443.     }7 @, v3 ]* H( _9 U: H5 C- H( A$ u
  2444.   end  K! J9 T2 s( V/ M' T5 a! l  n
  2445.   def mouse_in_area(ox, oy, width, height)% X+ e* I) a2 t
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    % V& V6 h/ _" u& `
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height7 b) E5 _; }# W; P9 P
  2448.   end
    - y7 O+ b: J, R# R/ }' E
  2449. end; t6 S4 ]' w! c7 a6 l: F0 r2 E
  2450. class Game_Interpreter$ `; H) q* r! ?- N' Y8 J
  2451.   def area_response(arg)5 `1 f) w# Y4 Y7 i- E9 _! N7 b
  2452.     $area_responses.push(Area_Response.new(arg))4 L. d1 V5 A$ l! O
  2453.   end
    ( [1 b' Q' w; H! g
  2454. end/ g) I( O$ M; ~0 P; n0 C4 Z
复制代码

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

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

GMT+8, 2026-7-24 20:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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