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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================0 k$ N2 e, C( J& z! ?3 ^: ~

  2.   l, F3 \+ }! X9 A. y
  3.   Sion Mouse System v1.3e
    5 E+ u+ Z9 v( C9 y- a
  4.   $ O/ y* S8 Q' e) ~- `0 c8 Z3 x/ G
  5.   Changlog3 I& H& Y" q& j8 w+ Q( ~9 h
  6.   
    # k9 y. n& g( ?( |' R! u9 G5 j
  7.   2013.4.21 v1.3f
    8 l/ n- e( o7 V7 }  y
  8.    
    ( D" P$ W, t: m& O8 d' l
  9.     1.3f 卷动地图 bug 修正
    1 E; x  H/ N) |9 R5 U" X% M! [
  10.    
    , `1 H: ~# h6 e0 a- t
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    ; e: @/ A* ?7 W1 z3 }/ ?# c% }; T
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    " i2 @2 U- v3 P6 D0 Q. K
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    : d3 ^/ z9 v$ W- D  I1 g7 O
  14. ) N3 m; ?% k  i
  15.     1.3f bug修正4 S1 a/ z4 e% F/ @# ?  F7 _
  16.   
    + |, _' f2 z6 x" R7 C
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    # `) d2 B# x0 w1 t6 D( y9 ~
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    2 \) ]0 ~8 {$ }* o, C

  19. % e  ^) @" `; A3 D0 f' j
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    $ P; m, A/ i- P& g
  21. . ]! n# X/ @* W0 u, F/ O" q  ~
  22.     1.3b 修正一些罕见的bug;
    ! l" ?! b" F$ @, m. o: R2 Y
  23. : a3 m. l+ `: r! C
  24.     1.3a 代码小修改;
    5 f3 [  m$ h6 ^0 D
  25.           加入了鼠标点击启动事件的功能,+ ^, [6 `( J2 a& ], T
  26.           在事件中加入“注释”: 鼠标启动  ,
    8 n* ~( L% @3 v! I
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    ( D8 W' W. ]" C9 |( {) }3 {7 J
  28.   
    3 N) }2 n6 A- c5 R$ C- G
  29.   2013.2.12 v1.2
    & w4 o- `* q) Z
  30. " ~8 R' c2 E3 _. h# N# Q2 H5 Z
  31.     寻路逻辑优化;
    ! T; V5 U) M8 M& |9 B
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;% P6 G; W- F5 b& B2 S" r" M
  33.     现在支持用鼠标来操作载具了。
    * p  l* Z4 U0 _$ g. _  J* t
  34. / J" t7 L) h3 Z. Y  ~/ A
  35.   2013.2.8 v1.1
      ]0 m6 Q- @& v0 O

  36. 2 N6 X! g1 i8 C/ C3 T. w5 C4 d
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;5 v& w6 E* g# h+ D$ k  L8 a# z5 E* m
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    5 n' l* T! s/ ^$ b' I
  39.     移动时,路径指示点的绘制更加稳定;5 ]! C1 ?& s% ~) h
  40.     现在支持默认存档画面的鼠标操作了。3 @( b1 Z9 R  O+ j
  41. ' F- r0 Y- j- i
  42. % I3 j  G) ^; `- C
  43.   OrigenVersion: f( `, n& P0 A# L' a4 T4 a  D
  44.   
    5 i, E! o* M* e/ H% X( |
  45.     2013.2.7 v1.0
    : M6 ?1 C3 ?& l8 }9 I' ?

  46. ; X5 D. R! q8 I
  47.   主要功能% Z8 i2 ]3 t7 ?$ ]

  48. 1 F$ ]3 X4 E$ R
  49.       使用鼠标进行各种操作...
    + X1 C# B1 E7 M: x! K# t: @( R
  50.       将鼠标锁定在游戏窗口内
    # z: i5 k* _. y' r) v! [* j
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    4 r( s( d* J( M
  52.       双击鼠标进行冲刺
    / B7 F& F' x  @9 E) A& _! z- i
  53.       更改地图卷动方式以适应鼠标移动5 G& x9 d' x2 A* D9 ~# I+ L
  54.       变量输入框改良
    : h9 X& w0 @$ @' }
  55. $ C7 M+ I6 K1 x$ y
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹7 A$ n6 `  u, v# J$ ?5 ?, z- `
  57. & ]( `2 {5 J% P6 y( C
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹6 r, O. R1 K, P. }, i8 e! R
  59. 3 _! d" h/ [5 E* W' _, O
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    - @  L. I- }. @& L" \  _

  61. ( p4 p6 f$ ?6 [. E) G; m
  62. * E( t- R. x; }" b- v% S
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    & g  D2 _, W% C( y  v: g
  64. ! J: H4 Y0 A+ a3 |" T

  65. # f: Y8 z8 s1 J
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示' _3 O- i  q! E, c. a+ P8 g

  67. & N& b& U5 ]; g( n+ K; K1 k0 m
  68. #==============================================================================
    " G# Y8 M" k- k5 ?
  69. # ■ 常数设置 5 n2 B6 i5 {9 ^, o: A# j
  70. #==============================================================================' z3 U/ J$ `7 L8 a
  71. module KsOfSion7 ?2 F2 U/ v0 c
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false+ i! w# [3 P' {5 {
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑# ]/ f# K6 b1 G0 Q5 m% S! g6 j
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false, y* g8 J6 |/ I" V5 v# o" ?
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量/ E7 V" ]" r; E0 a/ w. }7 {4 |7 A: P
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处( u; E1 d( Q& ]# H) `0 F( D4 Y
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    7 F* d% [* s  s, ^1 o  o
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)/ t' g7 ^; p6 v
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    8 Q6 `9 l. W7 s% p; w
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D); H$ P! P- O! S, f# ]8 _5 }: r6 j0 x
  81. end
    2 R! N2 W8 \# h' c/ P3 V

  82. ) u) k; I" ^) ?& q) b( x4 |( z% J, \
  83. #==============================================================================" T) I! {6 A5 Z7 m# y7 z9 t
  84. # ■ 用来显示路径点的类* y! B1 `: {7 T; \! e
  85. #==============================================================================- d( @5 u# `* c; _' P$ v" a
  86. class Move_Sign  Game_Character- R7 \: |0 @3 t6 t; }" k9 d4 [3 R5 n
  87.   #--------------------------------------------------------------------------
    ! G! c! W6 i8 c
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图2 G+ W4 D. X! i7 W* g! V
  89.   #--------------------------------------------------------------------------& j5 G8 R+ s# `% u! F( X" U
  90.   def init_public_members
    0 M4 G, x! f' U* w6 Y9 C
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹! {' L- T/ X$ j; v3 ~" P
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    % A+ A5 N* r: i9 }) {
  93.     @move_speed      = 5        # ★ 踏步速度
      V+ D' I* I! ?
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    ) F( F+ i( b) P8 _7 o4 ?4 ~
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度5 }- K- O6 G' i* c2 g# P
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    ' O  n% d+ `5 P0 G
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    & b3 Y$ U  C$ H0 m( c- n$ s
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)+ s  m% b- [3 Z1 B

  99. " @5 g0 G1 ^& \+ O) _! _
  100. 7 K8 x* G+ g1 G: b8 h% g/ t
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★2 c; z& {( q) c

  102. 9 h& _2 P/ N( j8 {  M
  103. ) ~: J1 Q- T! M* u, Q+ q' p; C
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图, X! I$ k3 c; F( v" P* A' I) ]% D: x. E
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    9 @! R* B- a( A) W0 h
  106.   [% a4 ?1 i/ w  k
  107.       if $no_arrowpic_warn  l' q1 g# s; Q0 ]. ^! j9 P
  108.         MouseShow_Cursor.call(1)
    9 y) T. w6 Z* J
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png. W* S8 W  I% K! b( Y  a' ]# G
  110. - {: q% e6 _7 E- E
  111. “路径指示点”将使用游戏自带图片
    . w) h# L( M; z2 {4 @7 V
  112. 2 {2 e' T9 G1 \2 H
  113. 该提示可以在脚本内关闭')2 u2 q4 K# N" b1 k7 g( `1 u' U! d
  114.         MouseShow_Cursor.call(0)
    + A2 K2 A/ P6 f" |
  115.         $no_arrowpic_warn = false" J+ P+ k8 |4 b  y  y0 j0 P
  116.       end
    1 D5 V( e9 \$ X! `% s/ L5 o
  117.       @character_name  = '!Flame'6 b% R0 n* P( m# M' y5 S4 C
  118.       @character_index = 60 ~1 @3 _7 ?! l  L; y$ H; c" R4 a* D

  119. - B: W+ w/ v2 r8 {) f3 @# u. V. m0 k% o
  120.     end
    / C5 H+ m2 \# z
  121.     @direction_fix = false  # 固定朝向
    : Q- o7 G3 o) j& z
  122.     @move_frequency = 6     # 移动频率
    ! C8 a1 N2 I! u, F/ ]* r5 W
  123.     @walk_anime = true      # 步行动画% k: X/ O2 E- a( f
  124.     @pattern = 1            # 图案2 A0 `# s- o+ H6 a3 D3 ^
  125.     @through = true         # 穿透
    . d1 c2 U8 T$ k
  126.     @bush_depth = 0         # 草木深度
    8 r) r7 h: T/ a) `: _9 n
  127.     @animation_id = 0       # 动画 ID
    * }: c. u1 ]5 Z. h! i/ |: A6 E& G
  128.     @balloon_id = 0         # 心情 ID
    + W$ o+ a" V% e# b7 j
  129.     @transparent = true     # 透明
    ! I; Z0 Q- l: {" Q9 N+ H
  130.     @id = 0
    , x( `5 z$ g7 z4 V& x
  131.     @x = 0
    1 d& q/ h2 t. z: @9 c8 B, z6 J
  132.     @y = 0; {' O. g! h& n5 X. H
  133.     @real_x = 0
    * `3 B9 U2 K+ q
  134.     @real_y = 0& R/ B/ p; j; ?4 n  }
  135.     @tile_id = 04 V7 t* g# `" }, B2 W
  136.   end
    . L1 O. t, [8 W$ g7 H2 Z4 W
  137.   #--------------------------------------------------------------------------
    2 }# `5 E1 Q' U) O3 ^, c" g4 p
  138.   # ● 定义实例变量1 D* k! k! L8 o% T
  139.   #--------------------------------------------------------------------------
    - T$ Z0 c- g' _) z4 m: V
  140.   attr_accessor direction0 Y4 h' M; J$ B  _! t! B+ N
  141. end
    : e1 f" |& H/ U, w: o# I" o4 M
  142. % K( [9 `6 _- w4 N
  143. #==============================================================================
    ( z. ^) t8 n2 c# {
  144. # ■ Module Mouse: w6 w- {$ X7 v; _
  145. #==============================================================================
    / ~" q4 M! b: y+ i9 w
  146. module Mouse) C( I  t. @: i. g1 n! e
  147.   #--------------------------------------------------------------------------3 R( P9 X7 R3 [' P
  148.   # ● API
    ; m9 q' e/ I) w/ {
  149.   #--------------------------------------------------------------------------/ X" |- U$ r' j4 o
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')/ a- g  q3 g+ E, w
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')6 Y7 @1 z  e4 Y3 q9 o
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    * n( j/ ?9 b" S, P- ]  b+ g
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    $ }: T, r! x8 L7 `
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')$ o, R2 A9 G+ e. O9 k$ w1 v
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')# R9 i; k& |+ _9 K) l7 i8 V
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')# d) ~+ G9 f3 j" J1 h, u( O
  157.   Window_Hwnd       = Get_Active_Window.call
    ' ^# Q/ K) P8 a
  158. 3 L$ m, V$ I+ B; U1 E
  159. class  self
    % f: I: @' k% y
  160.   #--------------------------------------------------------------------------
    8 U1 D- H0 D3 v
  161.   # ● 初始化( f& J1 r7 Z  A1 h
  162.   #--------------------------------------------------------------------------5 _6 T1 R* K3 K: k! P# b
  163.   def init
    . L* s, t- Q9 q& s, Y
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    4 R# N: E" y2 l! ~! n
  165.     @left_state = 0
    % ~/ N- X$ ^5 e1 l; F# v6 T
  166.     @right_state = 0% Z3 m. B: ?) s' H: ~
  167.     @ck_count = 0 # 帧数计,单击以后从0开始7 ^0 ^& C6 Y( r0 I% u7 N: O% F: Q
  168.     @dk_count = 0 # 用于双击的判定1 {$ ^0 E' p( Y) B+ ~" \1 G
  169.     @clicked = false4 O" ]' Q$ {# g2 C, D; S/ P5 m& e
  170.     creat_mouse_sprite
    ! H1 O' }. {, U- V
  171.     update! j! z$ D8 D$ E
  172.   end& s) Y% B5 j! L& D& D2 S
  173.   #--------------------------------------------------------------------------
    + u& V' i; r, |! `; k
  174.   # ● 鼠标指针精灵4 p' \6 z0 I& w3 Q" s
  175.   #--------------------------------------------------------------------------
      T, q: m0 ~  i4 }
  176. #~   def creat_mouse_sprite
    & C6 q1 v+ [5 D0 a& `; J
  177. #~     & e$ G: H! p* F2 Y# z
  178. #~       @mouse_sprite = Sprite.new: U7 \% k" O! ]7 I6 T0 M/ A3 R+ ?
  179. #~       panda = 2#rand(2)+1! ?' B; P5 a$ p4 E. N/ C
  180. : t. E/ B6 c2 ]; d7 b7 f
  181. #~      if panda = 1. N5 g* l* W6 D! \5 ]" ~
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    4 c: C0 D- K. R+ X8 h
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    6 M" G( P7 e* u3 M6 Z
  184. #~        end#with if File.exist  |) J4 @' b- ?. _5 S( d
  185. #~   
    3 U4 l% u7 ]' C5 X  j) l9 q
  186. #~     else if panda = 2 #with if panda=1
    : g7 ~7 E% @; d# o- L
  187. #~      0 a' z* l  F& K7 E; H- n
  188. #~      if File.exist('GraphicsSystemCursor2.png')+ e1 M( C* `$ C+ l! }8 {& o
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    9 N+ u5 J  t& T  z* L
  190. #~      end#with if File.exist
    4 l3 v7 y1 s6 a# N/ T$ h* r6 A, j' x" _
  191. #~      
    # J  Q( k: z- y# ?
  192. #~     else #with if panda=1+ T( E0 Z% t; Z6 n9 a4 d9 j
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)) w$ f) ?8 K+ l7 s( O/ H, y0 Q
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    7 n) b" G/ a- U- j
  195. #~       Rect.new(5  24, 24  24, 24, 24))8 r7 C$ f- r, c/ W8 F
  196. #~     end#with if panda=14 K; I8 b! W( V2 J
  197. #~     & Y' ?3 C' y, Q9 i. o: S1 {
  198. #~     #with def6 G6 R5 B: E( d; p
  199. #~   end2 }: F. m8 P0 Z5 a. p( R
  200. def creat_mouse_sprite
    ; b. n6 E1 S# V* x3 T6 I
  201.     @mouse_sprite = Sprite.new
    . e) |; S- q2 U9 F) m1 X$ a; s
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    : x: F# _# f' d! u( D. k
  203.     @mouse_sprite.z = 9999/ P$ t. I  X$ }. D3 b* Q# ^1 a" F
  204.     Show_Cursor.call(0)
    # y0 u& R: b$ d, ~9 j- h5 b
  205. end
    $ C( ~. q" c! b- @4 n

  206. ; Q8 r4 L- H8 {) r; w6 Q/ s
  207.   #--------------------------------------------------------------------------$ }5 y9 d# ?. [  s0 u% _" ~$ w
  208.   # ● 更新
    1 f6 s* ]% @% O9 E  C- S: W# _
  209.   #--------------------------------------------------------------------------+ W5 v# W0 E% o+ i% t* a( i/ y0 J
  210.   def update8 r/ g0 }7 j* q' @0 B! {
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    6 Z! T2 B# g  {
  212.     left_state  = Get_Key_State.call(0x01)5 z+ [1 V5 ]4 T1 e, ^
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    ! J% n- }7 l: m+ d4 V
  214.     right_state = Get_Key_State.call(0x02)
    - K% Q2 i0 p  [; K* n1 |
  215.     right_state[7] == 1  @right_state +=1  @right_state = 00 q5 l, x+ U; W, B# E. \1 c3 h
  216.     update_double_click3 ]- l5 [1 a0 D$ B  b& B
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1! H, n! l( H1 I; V& J; U
  218.   end) G/ v3 |7 e3 L! L5 C9 A8 p
  219.   #--------------------------------------------------------------------------
    1 d7 l( ^; s$ o
  220.   # ● 获取鼠标坐标, W5 X$ O! `7 S7 {/ w
  221.   #--------------------------------------------------------------------------# M, C, C+ b. `, @
  222.   def get_mouse_pos) d; Y7 L$ X0 `  E6 @
  223.     arg = [0, 0].pack('ll')
      [( ^) \1 l2 l* b
  224.     Get_Cursor_Pos.call(arg)
    - |6 @( ^1 Z/ M  Q
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    / t8 h+ ?; \& \( |9 v. X0 j7 ]
  226.     x, y = arg.unpack('ll')8 S6 F' x: \' U) z# e
  227.     return x, y
    . o# X* L( d, P& k6 L6 Y# z
  228.   end
    " O1 E0 D: q- J, P7 I. ^
  229.   #--------------------------------------------------------------------------' b5 a4 ?7 J' n5 @0 d8 q
  230.   # ● 将鼠标固定在屏幕内
    * o2 Q4 ?" a$ x8 [$ p% G: n
  231.   #--------------------------------------------------------------------------
    - v0 ?5 A% _- D  X1 [+ p
  232.   def lock_mouse_in_screen
    , `8 r1 U+ T2 H* Z7 ^
  233.     arg = [0, 0].pack('ll')
      l$ E- s# F6 t2 Z3 O! ]# I( Q; n6 w
  234.     Screen_To_Client.call(Window_Hwnd, arg)$ f  [9 }/ `7 ~2 W
  235.     x, y  = arg.unpack('ll')
    : H/ Q: E1 d- H/ w  _6 M5 z* }
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    # y% S- ^9 S+ h& m$ l% v
  237.   end7 z! x, ]5 S1 B$ f
  238.   #--------------------------------------------------------------------------3 _; F' g0 f1 Y4 C) R+ s6 Z4 j
  239.   # ● 解除鼠标固定
    , n4 N! W6 H* q! q# {7 S
  240.   #--------------------------------------------------------------------------
    ' F# B! {% f6 L- [4 Z2 r" `/ y
  241.   def unlock_mouse_in_screen, N$ f1 T* P: ^1 b
  242.     Clip_Cursor.call(0)
    " `1 M+ K2 L; S9 S( c" ?
  243.   end
    & u+ ]3 y$ g- k0 O+ n  |
  244.   #--------------------------------------------------------------------------
    ( D, f) ?1 p% y7 n
  245.   # ● 鼠标双击判定4 `" o% |4 U4 \2 g% A
  246.   #--------------------------------------------------------------------------
    ! D3 j4 e2 p  z, `* l
  247.   def update_double_click
      h% f2 y$ E$ z9 z, @0 K
  248.     @clicked = true if @left_state == 1
    8 X5 m+ R* c" e
  249.     if @dk_count  0 && @left_state == 1. ?+ \3 o% [# H5 k6 \" v# P
  250.       @dk_count = 0; @clicked = false
    0 u% y& G- |, P3 e+ p  m
  251.       return @double_click = true* j& A% |( V: y$ I9 w
  252.     elsif @clicked7 L: \2 p+ t: `% V% e8 h) H3 \
  253.       if @dk_count  KsOfSionDbclick_Frame% ^9 w" M  k+ j
  254.         @dk_count += 1
    : ?* ?9 x4 K" @7 G
  255.       else
    - `' U4 V4 V- Z
  256.         @dk_count = 0; @clicked = false
    - p3 i+ M0 M. b, c
  257.       end
    ) }$ w5 Q, U7 D
  258.     end
    . K% }; h$ ?6 _8 C2 P4 D& y
  259.     @double_click = false
    4 O# |( [' V" ~+ N. v5 ^
  260.   end" S9 N9 V; D8 }3 c
  261.   #--------------------------------------------------------------------------
    3 C+ [& V6 d, f: W5 P
  262.   # ● 按键被按下就返回true( q* N" |+ A+ [. h  V' j
  263.   #--------------------------------------------------------------------------
    ) Q& b% U% m( n, U0 M
  264.   def press(button)
    ' ?3 n" `4 \  q9 q- t! l
  265.     case button8 w' z9 T: V) L/ I/ p
  266.       when 0x01; return !@left_state.zero9 h1 {! k- r- x9 W, k
  267.       when 0x02; return !@right_state.zero  o4 A9 r8 \' ?% u$ k) k
  268.     end
    . ~' g6 ]! a9 y1 q9 L: s
  269.     return false
    + X2 D! n; E) B  H2 X( T! B
  270.   end
    5 G  r1 h  Y0 D' K
  271.   #--------------------------------------------------------------------------5 {- E3 T$ h: T
  272.   # ● 按键刚被按下则返回true
    ! a; E8 C7 c# v6 ^. K: i
  273.   #--------------------------------------------------------------------------+ Y2 r, \6 X. M* ~7 n2 m
  274.   def trigger(button)
    , p% Q" v6 U! {& T; g
  275.     case button" `5 g4 Z' l, R; t
  276.       when 0x01; return @left_state == 14 i( b( q# W: @' c" {9 R
  277.       when 0x02; return @right_state == 1) n. k: F: a  Y* T  \
  278.     end' B2 i& }9 Q6 o2 \: y
  279.     return false
      T; g0 J$ d; X: o" e1 W
  280.   end7 [: j- E: R6 |5 l0 _2 U2 [
  281.   #--------------------------------------------------------------------------$ j6 ~4 m2 W6 F5 g$ f; F  l& b
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    5 Z* F" k/ v8 x5 W' W
  283.   #--------------------------------------------------------------------------
    6 p# `7 b1 T  W0 b# Q
  284.   def repeat(button)
    % a. u% l' \% k
  285.     case button
    ; V: j, w( F$ V
  286.       when 0x01; return @left_state == 1 $ `0 v% P% n, e' r
  287.         (@left_state  22 && (@left_state % 6).zero)$ \  Z) S, Y! {, x& F3 G* F, K
  288.       when 0x02; return @right_state == 1
    * i% i2 C) G7 G. x3 m+ V
  289.         (@right_state  22 && (@right_state % 6).zero)# Z1 J/ y* z! }& h$ J  S$ U+ _
  290.     end
    & N" ?& u' K- M: d
  291.     return false( R; y: ]" y# _. g* h8 h3 Y
  292.   end
    1 P; ^2 S  n! L
  293.   #--------------------------------------------------------------------------
    & ~+ D4 v* D  Y" l0 C8 U0 z( D
  294.   # ● 判断是否双击鼠标) m- J" [2 f9 |; Q( J7 P4 w/ s
  295.   #--------------------------------------------------------------------------7 v4 t+ |+ B( u% u( X
  296.   def double_click" u2 ]6 [( F" `0 @; ~( j
  297.     @double_click
    & ~; ~/ E) Z& A) `: q: B
  298.   end
    1 Q6 d% n; q. O0 |3 D( E
  299.   #--------------------------------------------------------------------------
    1 h& n$ z& P, u
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)$ A: ^8 U. F1 i5 f+ N& D, P8 t' H
  301.   #--------------------------------------------------------------------------
    1 x1 O5 L9 |9 f
  302.   def click_count
    % q2 U  B" K0 w" z0 A3 a. J9 j
  303.     @ck_count
    0 w0 ]% F% F  _2 q4 Y5 U3 Z/ g
  304.   end% k- H* B" M# q2 R  K9 f9 w
  305.   #--------------------------------------------------------------------------
    % O4 ^& r0 |, `0 L% m+ o
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    " P. D2 X; X- K( A
  307.   #--------------------------------------------------------------------------
    0 ]! x9 U/ x8 K& v2 ^
  308.   def left_state9 ]$ G9 f# D" @5 G- ~0 Z
  309.     @left_state* Q& {' ?* x  Z. G. C* t1 X
  310.   end- o5 Q0 ^7 D4 @! i! x6 k% h
  311.   #--------------------------------------------------------------------------( T$ J2 S. M" a
  312.   # ● 获取鼠标的x坐标1 E5 `  |5 u7 L2 I  L
  313.   #--------------------------------------------------------------------------
    ! Y) X9 Q; d+ R: p( I
  314.   def mouse_x& j/ Q, i7 z3 ~" N: {
  315.     @mouse_sprite.x
    & f6 r, o) L5 J* U9 V' s; W* Z3 i
  316.   end, I+ P5 E8 I' A/ o
  317.   #--------------------------------------------------------------------------4 d# E, C1 o9 T6 J" {! G( }- T
  318.   # ● 获取鼠标的y坐标3 s4 G- |1 e# G0 ~, b( Y
  319.   #--------------------------------------------------------------------------3 m8 y1 b. G, ?+ a) m1 u7 z" H2 e  I
  320.   def mouse_y
    & b. \9 x8 M  @
  321.     @mouse_sprite.y& C: ?5 G, h3 u1 `% D
  322.   end
    , D( C2 e2 @# c9 J
  323.   #--------------------------------------------------------------------------
      {8 p" C& ]1 O
  324.   # ● 设置鼠标坐标. x  H) G' f4 _3 f) {
  325.   #--------------------------------------------------------------------------
    1 m$ I! F3 N; S
  326.   def set_mouse_pos(new_x, new_y)
    $ F7 C" i: N8 A5 G
  327.     arg = [0, 0].pack('ll'); T1 _; M( r( |7 d
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    7 f5 ]  @6 j' F8 V7 l: m
  329.     x, y  = arg.unpack('ll')
    7 N, }8 b( j/ o2 P8 ~  F; G" ?
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    * d( w( Y2 B3 @' x
  331.   end
    1 B+ \. W" Y, V+ T9 b1 |2 a* d
  332. end #end of class  self   Y" D4 ?! N$ Z2 v

  333. ! Z+ [- e+ s- w
  334. end3 H2 ]# ]: y( Y* I) H4 i
  335. / T4 Y1 L* k* ?" N4 X' \
  336. #==============================================================================
    $ _* L- G+ g: ^* o6 p' `
  337. # ■ SceneManager+ b( z+ Z6 W4 i  U, h1 v
  338. #==============================================================================, F7 r! V& P% U6 L0 V
  339. class  SceneManager/ d% u$ `8 v; g4 g+ ^& z8 w+ [
  340.   #--------------------------------------------------------------------------3 o  }, A; ?% s" u$ r
  341.   # ● alias: W! z& P2 R) C- T
  342.   #--------------------------------------------------------------------------
    , v! O3 \8 p9 S% C% [! R' k$ d0 z
  343.   unless self.method_defined(sion_mouse_run)! ~0 z3 s/ R" [4 }
  344.     alias_method sion_mouse_run, run
    , U# c. H5 v+ J( b
  345.     alias_method sion_mouse_call, call+ B3 r; X; Y0 S6 C4 m/ B
  346.     alias_method sion_mouse_return, return
    ' x4 M$ ?7 g) i" I
  347.   end
    . b9 F. l: {4 h( J3 `* Y' x5 V
  348.   #--------------------------------------------------------------------------
    6 V# E5 J  r' c# K- H% I$ A
  349.   # ● 运行
    5 D+ L7 L0 o6 [* y" T2 X$ x. C- s
  350.   #--------------------------------------------------------------------------( i7 W5 ~# S, @3 s. Y+ H
  351.   def run% e/ x' q& ?% {& [( F
  352.     Mouse.init- L) }% C2 @6 _, m0 z% ~+ H
  353.     sion_mouse_run: u0 M& @' J) w) y. {$ X
  354.   end
    7 Z4 e% Z5 T8 r8 A* Q! u+ H
  355.   #--------------------------------------------------------------------------
    ; w% X$ `; Z. O
  356.   # ● 切换
    $ E. N( {2 _, l) g* O4 N7 @/ C
  357.   #--------------------------------------------------------------------------* U# a; d. t5 q2 r2 R7 C
  358.   def call(scene_class)
    % t9 g8 ~. n& O0 B6 [- \/ M
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)# y8 p3 X# ?) l: ^7 I$ O
  360.     sion_mouse_call(scene_class); l5 {( V3 g& G  |$ u- g$ o7 M
  361.   end) |5 |8 J) q9 e3 x& E+ r; H) s8 G
  362.   #--------------------------------------------------------------------------0 @& L+ `: d3 c% A
  363.   # ● 返回到上一个场景
    8 o! H0 x9 n/ s3 v
  364.   #--------------------------------------------------------------------------5 T7 n9 g6 f. i9 L
  365.   def return+ I# q. E5 A" {: G
  366.     sion_mouse_return
    5 o0 }- }  R5 G+ l
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&6 J% U9 T+ G4 X9 Q& F3 \2 y4 D
  368.       @scene.instance_of(Scene_Map)3 x- \  T* L# r' Z0 [
  369.   end
    , W8 H* ^+ h& Q# t7 s
  370. end
    8 g+ f: p. `, N. y
  371. + z1 C/ ?) d% b2 }
  372. #==============================================================================' y/ }/ J2 T9 J4 H' ~. ?3 o
  373. # ■ Module Input
    ' b# `% V; s% ^8 P3 M
  374. #==============================================================================
    $ b. p( N) L3 ^, _* _
  375. class  Input
    7 i! h% O" z4 T+ M2 u! F, v$ ~
  376.   #--------------------------------------------------------------------------% H9 ~9 t8 @. r, l( n8 P2 M
  377.   # ● alias/ e2 H5 ^5 c  F$ l
  378.   #--------------------------------------------------------------------------- M  p" q2 b: b4 W, O3 }
  379.   unless self.method_defined(sion_mouse_update)" |7 |. Z) D; e6 h! p3 t$ l! O
  380.     alias_method sion_mouse_update,   update
      [$ X% g9 u% [
  381.     alias_method sion_mouse_press,   press; [5 H/ ~) _" S: Z
  382.     alias_method sion_mouse_trigger, trigger
    5 ]* h8 }2 e7 H' Q
  383.     alias_method sion_mouse_repeat,  repeat
    # t2 e# _% F- k- A: s
  384.   end  i; ]6 Y! g9 e8 r
  385.   #--------------------------------------------------------------------------
    & F" x: F5 |: I8 m; R1 I
  386.   # ● 更新鼠标
    $ P2 m$ K8 Y9 u1 \+ e) }1 `; F# ]
  387.   #--------------------------------------------------------------------------
    . S, w0 g0 A  J
  388.   def update
    : B6 D. U4 l& O% {) [6 F' q
  389.     Mouse.update
    $ G: \0 D6 I8 q( |* X
  390.     sion_mouse_update1 n* ]0 }+ q/ d; x
  391.   end, {6 ~# v9 b: n$ F7 k4 x
  392.   #--------------------------------------------------------------------------( T3 D  j, A* K. S$ `
  393.   # ● 按键被按下就返回true
    : _1 l  V& u$ O5 V. n, s! T7 ?9 L
  394.   #--------------------------------------------------------------------------( h7 j/ m; I0 S
  395.   def press(key)
    ! B8 [& \. V' Q5 N
  396.     return true if sion_mouse_press(key)
    . R+ t" L1 Q; N1 ~% k8 G: g
  397.     return Mouse.press(0x01) if key == C  ~1 r1 P  C7 v& U0 v6 y& M
  398.     return Mouse.press(0x02) if key == B
    * j; k& e, h& e
  399.     return false
    $ j8 X* d3 L" d. T4 g
  400.   end* x% r4 h* w- Y, W
  401.   #--------------------------------------------------------------------------1 r% {0 @- D) I6 k  U8 b2 P
  402.   # ● 按键刚被按下则返回true+ ]4 k6 I; t; w  ?% I/ G/ h% F
  403.   #--------------------------------------------------------------------------4 [: k; t* x$ m) E1 i& s+ H
  404.   def trigger(key)
    * `0 _- Q( q0 ]
  405.     return true if sion_mouse_trigger(key)
    * K! V' `% ~; P4 j
  406.     return Mouse.trigger(0x01) if key == C. q! V. U8 A% [+ N
  407.     return Mouse.trigger(0x02) if key == B9 n- N! a/ `6 q1 b
  408.     return false
    % L' ?# e$ E' d; c6 S: [4 F
  409.   end/ x( r3 o8 s. Z# Z
  410.   #--------------------------------------------------------------------------
    3 B: E9 ]) j9 t6 p) \
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true7 f' Q  l# h$ e) e. \4 S
  412.   #--------------------------------------------------------------------------3 Z2 P# _. \9 M; O
  413.   def repeat(key)- ?0 t3 \6 e" L0 F, Y
  414.     return true if sion_mouse_repeat(key)3 a5 o% k) s- l6 j" k, b
  415.     return Mouse.repeat(0x01) if key == C' l, E4 V7 u- o8 W3 a# {- a
  416.     return Mouse.repeat(0x02) if key == B  M4 U6 R/ i: s6 P. }5 ~
  417.     return false" E3 M8 ^8 U% E$ _/ }" ^# @
  418.   end  m/ Z5 F' l* d& n
  419. end, [0 n, C4 t# d! J" A3 D
  420. 9 j) }! @2 W/ G4 }" v5 L
  421. : p4 A/ U3 [: j1 w' i
  422. #==============================================================================, }( s+ m+ Q- B  z
  423. # ■ Window_Selectable
    " z0 C, |! Z6 Y! c" U
  424. #------------------------------------------------------------------------------9 b8 K+ [% U+ a0 H' u( |
  425. #  拥有光标移动、滚动功能的窗口
    4 t0 p  B+ j2 a
  426. #==============================================================================
    / q0 }; l! o! y7 J; B
  427. class Window_Selectable
    8 q$ \& X1 }' p$ _! T8 Q
  428.   #--------------------------------------------------------------------------6 P3 A; C. }0 `- W- l
  429.   # ● 初始化5 N4 t) \& u; Q! \; p3 F* Z. P
  430.   #--------------------------------------------------------------------------
    + \, Y+ b3 v, F# r4 y+ f
  431.   alias sion_mouse_initialize initialize3 j+ a$ z5 ^1 f5 ]. t$ R& m, d. g
  432.   def initialize(x, y, width, height)
    7 O* f. C9 c3 w/ m0 {+ m' M
  433.     sion_mouse_initialize(x, y, width, height)
    + |4 U+ l2 U6 R6 J: p
  434.     @move_state = 0* {3 G# m4 r$ j8 r  N3 j
  435.   end
    - v8 |& x* G6 E* T8 G2 I
  436.   #--------------------------------------------------------------------------9 r/ B3 o/ H! f2 d
  437.   # ● 更新
    ! K+ n1 \9 k! R* z" q; a/ g, k! g, [
  438.   #--------------------------------------------------------------------------  p# W( U7 |3 r' r, g
  439.   alias sion_mouse_update update
    . B; g( t! n  p$ V) x
  440.   def update1 _( v! a" z4 D% Q# j. A# O# N4 |
  441.     sion_mouse_update( R) A4 T# U9 P- b7 e
  442.     update_mouse_cursor
    5 J7 g; ^1 T( v# q6 F! ~2 i' k0 n
  443.   end
    . ^/ N1 ^# u2 w
  444.   #--------------------------------------------------------------------------
    * J, [$ X: y& N* a# a2 y. w7 l
  445.   # ● 启动后设置鼠标到index位置+ H4 f: ?% h6 H' [  H
  446.   #--------------------------------------------------------------------------
    1 v1 M, y$ B$ k$ f+ y4 S
  447.   def activate* M. ^) E& S5 Q: [
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    " @* S5 t! U. J3 z# s9 T, S" \
  449.     super* W. ]' `! ?9 N. ~' I, n- T
  450.   end% n" [/ @9 U% {" P. B
  451.   #--------------------------------------------------------------------------, X& L$ O- v# u6 c
  452.   # ● 更新鼠标和光标的位置- F" i- `0 F: g
  453.   #--------------------------------------------------------------------------, {7 h9 B& e) `7 s
  454.   def update_mouse_cursor
    7 H& U( `7 t/ b; b- j4 k
  455.     if active
    ) H1 z; u. y% `. u8 b6 e
  456.       if @need_set_pos
    6 z8 @1 X+ C: g
  457.         @need_set_pos = nil8 D* M- N9 {* M$ ]! }2 U
  458.         set_mouse_pos
    & V4 Y3 H5 d% @- M! e; s9 s
  459.       elsif cursor_movable5 V: ]9 @: i3 F1 z3 u6 m
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
    0 @5 \1 e8 M/ N4 Y# z1 h2 D
  461.       end! a2 Q) k* P$ v) {( L
  462.     end% H! C3 y" x, ?. l% t
  463.   end: f5 H2 V5 i% Z8 s. l5 p5 `
  464.   #--------------------------------------------------------------------------
    $ ~0 E( T$ M7 e4 n8 y
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能1 p! [/ l& G/ {) k) M4 X
  466.   #--------------------------------------------------------------------------
    . J$ O7 C! [3 _7 ?
  467.   def set_cursor
    - Z4 ~8 y5 ?4 v: I
  468.     mouse_row, mouse_col = mouse_window_area
    . G& h6 j# V- o8 @9 R, j
  469.     if    mouse_row == -16 A# F6 @7 x+ i8 _1 A1 o
  470.       @move_state += 1 if need_scroll% a" b' o4 I1 Y5 n
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand8 ~7 K$ f+ |& X
  472.     elsif mouse_row == -2
    1 M4 q  `& N# Y3 ]
  473.       @move_state += 1 if need_scroll
    ( v+ v5 H' j7 V+ n+ G$ O! k  s
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand7 O+ l- O' |( C7 v* X0 u
  475.     elsif mouse_col == -16 H+ [# U" Q6 S6 E2 q
  476.       @move_state += 1 if need_scroll
      l& t* U% x/ t$ v; Z3 O% E5 C
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand' I6 O1 v/ r3 p3 Z4 u
  478.     elsif mouse_col == -2
    - Y; G) T5 Y5 g/ B+ @
  479.       @move_state += 1 if need_scroll. O# ^  G. n1 M, b$ {- g
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand9 I+ j2 B( [# g: E
  481.     else- ^/ _" }! v' T8 U
  482.       @move_state = 0
    ( h1 r/ ~% Q6 m5 [& }! I, W  ^
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    " V; M( V+ s, |: d7 G9 S
  484.       select(new_index) if new_index  item_max && new_index != @index
    # |) u# }+ A1 n3 k: E
  485.     end
    5 k3 B" ^, {+ P  S
  486.   end9 I' z6 n0 G1 z9 c
  487.   #--------------------------------------------------------------------------! y' I& g$ ]" W" ^. A( g
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    ( y2 y1 W5 A3 @. G
  489.   #--------------------------------------------------------------------------
    ' P; e) p8 Y6 ^
  490.   def mouse_window_area
    # }$ N: y" {1 J/ g
  491.     if viewport.nil # necessary!; y( O- m/ s/ Y: T1 b/ R1 u) V5 A: L
  492.       vp_x, vp_y = 0, 09 ?  S! ?4 U  j& Y0 Y6 q
  493.     else+ v( u5 H/ z2 O  I0 W  w
  494.       vp_x = viewport.rect.x - viewport.ox& _9 }/ K- m7 z  i
  495.       vp_y = viewport.rect.y - viewport.oy
    5 v" M6 ?/ i- c4 R2 a  ~
  496.     end5 U9 j7 ^4 z% w4 q
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    4 @) l" J1 o3 W; x; z. S  J
  498.     item_x1 = vp_x + x + standard_padding ! N3 ]7 b! Q& v" s
  499.     item_y1 = vp_y + y + standard_padding
    ' W" u( ^* D% ^3 D
  500.     item_x2 = vp_x + x - standard_padding + width
    2 ^& `/ w7 k/ ?- Z
  501.     item_y2 = vp_y + y - standard_padding + height8 H- }% }3 f$ D# u, d+ P( ?6 l7 Z
  502.     if mouse_x  item_x16 L+ h, j. I8 m5 v: e- o
  503.       mouse_col = -1
      e5 q8 g8 a9 ]) n
  504.     elsif mouse_x  item_x2  z  ?. o% F4 R. J
  505.       mouse_col = -2# p  d/ p. h7 I& V7 C) o
  506.     else) e* L5 x8 R# C: I0 R8 p/ e0 B. k
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)# M8 _; b; H7 p
  508.     end
    : y; X* H6 n: _9 l: S
  509.     if mouse_y  item_y1* T  d, B. i- l# v! _
  510.       mouse_row = -1
    0 P# m: q# v0 ~* J3 n- g: z
  511.     elsif mouse_y  item_y2& s) s/ M4 E) v$ M% x
  512.       mouse_row = -2, b! h* r# H3 Q5 v, y
  513.     else
    1 {4 Y+ P, j2 Z) J, s. @
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    9 E1 H$ P/ a4 K
  515.     end/ \: F4 W: R" k, V4 |
  516.     return mouse_row, mouse_col
    - ^2 b' f6 g3 [2 r1 t" W& o3 v
  517.   end& t, O# ?4 I. I' b
  518.   #--------------------------------------------------------------------------
    / {* V7 \/ B1 `, t) t2 r0 y
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    # M+ o" f" J* z! t, x' E
  520.   #--------------------------------------------------------------------------$ F/ t9 [/ B) X$ r3 G! }
  521.   def set_mouse_pos4 A7 v' g/ [, t
  522.     if viewport.nil # necessary!
    / M7 e9 n& C3 i  J  b" Q
  523.       vp_x, vp_y = 0, 0
    - d+ U" a+ J; l7 _
  524.     else
    + ?3 E, L& r7 C4 Q" ?
  525.       vp_x = viewport.rect.x - viewport.ox- j4 a* e. r9 c! z! H
  526.       vp_y = viewport.rect.y - viewport.oy
    8 P# y) ?; M7 o3 K
  527.     end
    - i" Q/ z' g  H- u% `% z
  528.     item_x1 = vp_x + x + standard_padding - c; ?% w' G0 ]5 Q1 l8 F) ^9 ?; a" i
  529.     item_y1 = vp_y + y + standard_padding6 Q: y. _( Y" f* o/ Y8 @
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    3 t. P6 a( T' t0 \5 Z: I
  531.     row = get_index  col_max - top_row4 l2 X0 _+ Y6 Z. v
  532.     col = get_index % col_max+ A3 ]8 e$ ~3 |. V# L. P/ \
  533.     new_x = item_x1 + item_width  (col + 0.5)( k& z* V, L) @* ^8 _
  534.     new_y = item_y1 + item_height  (row + 0.5)
    : B/ E. I: x! u) n+ `8 ~. a
  535.     Mouse.set_mouse_pos(new_x, new_y)5 l$ d7 P' S/ p) h! N# C
  536.   end3 w# a, ?0 f4 O/ v4 Q! N
  537.   #--------------------------------------------------------------------------9 m/ T+ S1 t3 i/ ?  C8 T& m
  538.   # ● 判断菜单是否需要卷动. W1 r7 Q+ ?2 ^' o
  539.   #--------------------------------------------------------------------------$ I- Z7 @$ `5 l: X; u' J3 j
  540.   def need_scroll. m/ `5 }; _7 G& z+ j( Z
  541.     item_max  col_max  page_row_max
    8 @! ?. u& i0 R' m8 q
  542.   end
    - B6 @: O3 C+ r+ L2 ?
  543.   #--------------------------------------------------------------------------
    ' Z' }+ Q, W# I% M
  544.   # ● 判断是否为水平卷动菜单
    ; f$ _5 G/ o0 d$ C( b
  545.   #--------------------------------------------------------------------------
    4 a  @; M4 G) ^2 q" j& `$ }
  546.   def is_horzcommand  ~% D, S# O* C- B4 S% H
  547.     return false
    + t4 z0 f6 R+ A" s7 k/ Y/ U9 b
  548.   end
    $ u9 Z* ~$ F. [3 M# ^
  549. end
    6 d) Z4 j3 g2 [& K/ _

  550. # A2 L9 v( A. B- R& ?
  551. class Window_HorzCommand+ z  u$ X) }9 a2 ]' t  `7 ~
  552.   #--------------------------------------------------------------------------
    7 A% V( D  j! g3 I# j/ i  C
  553.   # ● 判断是否为水平卷动菜单
    + A7 @+ P/ z! y* ]
  554.   #--------------------------------------------------------------------------5 p/ O# U1 z: l/ c
  555.   def is_horzcommand
    3 _8 q; W# [$ [1 J
  556.     return true
    1 h* i7 ^# p; M- @  V4 \2 [/ j
  557.   end3 m6 S: {8 \. c3 \8 R
  558. end9 [1 F7 K8 K3 D2 M" [

  559. 3 z1 W  k0 T8 y$ _7 C/ d( V' |2 E
  560. #==============================================================================
    ) i7 T( e& g4 Q# s8 K* E( k/ a
  561. # ■ Window_NameInput
    / A1 \  U9 c# y
  562. #------------------------------------------------------------------------------! @0 |2 g/ O9 I$ z$ f8 \( a
  563. #  名字输入画面中,选择文字的窗口。
    : K: [8 _2 A* \) L1 S3 l
  564. #==============================================================================# I4 {' v! B  P' y
  565. class Window_NameInput, x5 W1 }% U* N: p7 N* ?) f2 l8 j
  566.   #--------------------------------------------------------------------------1 Y* o! S! j8 ^& o
  567.   # ● 设置列数
    7 P( Z: I! ]3 {4 I
  568.   #--------------------------------------------------------------------------
    ! q4 G! d# I2 j
  569.   def col_max
    ! Q/ [( a5 k2 j9 I9 j+ n. t" O
  570.     return 10
    ' x) g; A8 b) f$ e: O" J
  571.   end
    + A8 p' L0 q& U. N
  572.   #--------------------------------------------------------------------------
    3 k! @3 j7 z/ h+ A& ]" w2 \
  573.   # ● 设置填充的Item个数
    9 U8 ]) @& J3 P
  574.   #--------------------------------------------------------------------------6 G/ R8 S# z- h8 H
  575.   def item_max& B6 U7 n7 D' n- V
  576.     return 90
    ) y0 n, h  m2 Q* _1 v7 H
  577.   end6 Y3 T3 C, {+ \, e
  578.   #--------------------------------------------------------------------------
    ; D$ o% M6 ]7 D0 h$ E- e' x
  579.   # ● 设置填充的Item个数) `+ g; I7 f, [7 z4 Y' j
  580.   #--------------------------------------------------------------------------- W3 x: g  e1 y) b9 A( L! C
  581.   def item_width
    * N4 |& ?, B. L4 e
  582.     return 32
    2 L+ L, F) `+ j9 Q, s5 n1 ]
  583.   end! k( d* [; E2 H6 x% M
  584.   #--------------------------------------------------------------------------9 N% Z) J2 Z  x2 B
  585.   # ● 判断鼠标位于菜单的第几行、第几列+ C: V8 }1 R4 K! f. m/ E9 }
  586.   #--------------------------------------------------------------------------* o( I8 L  b3 S/ p1 ]
  587.   def mouse_window_area
    - u1 V( g' H+ [0 a9 J  C; Y7 d* O
  588.     if viewport.nil" L# X  k" ~) K, l
  589.       vp_x, vp_y = 0, 0
    ( e5 M) e5 I" ^  d1 u6 O* m
  590.     else9 m/ D! ~3 M2 R# y
  591.       vp_x = viewport.rect.x - viewport.ox
    # i5 V. m# S9 s+ s& q
  592.       vp_y = viewport.rect.y - viewport.oy
    1 j/ Q* q# ^6 b, p( b0 h) E( C
  593.     end
    : G, r& v% N7 a/ ~% ^
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y; y4 p$ o5 Q' |8 h
  595.     item_x1 = vp_x + x + standard_padding 1 |! N7 {5 r+ g- g
  596.     item_y1 = vp_y + y + standard_padding7 X$ Z( Y& z1 _( i# o' w% ]% c
  597.     item_x2 = vp_x + x - standard_padding + width! }, L: x# D7 E" d
  598.     item_y2 = vp_y + y - standard_padding + height. M! G  C/ X4 w9 b3 x& r( I$ @: k$ q
  599.     if mouse_x  item_x1
    5 e* B% ]' t) D8 R; i
  600.       mouse_col = -1
    . W% [6 I$ W" }) ]! a) ^
  601.     elsif mouse_x  item_x21 ^5 d0 N( C+ h4 i
  602.       mouse_col = -2
    6 V  Y7 Z0 l& F' S
  603.     elsif mouse_x  item_x1 + 160* ^- X( B8 C7 l3 X
  604.       mouse_col = (mouse_x - item_x1)32( Y. `: m4 |' k1 R
  605.     elsif mouse_x  item_x2 - 1602 O% o9 H( L' k; P/ l8 v
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    , \2 j/ T  {& r
  607.     else
    ' X% `4 I5 [* N+ C
  608.       mouse_col = mouse_x  x + width2  5  4
    7 A/ b1 Y! z! x! u
  609.     end
    3 n3 z! ?4 t# v% M* y' [
  610.     if mouse_y  item_y1" A$ j! q1 I8 a. P8 B8 w
  611.       mouse_row = -1* Q% R' H, O( v
  612.     elsif mouse_y  item_y2' e* M7 s/ B# |9 ]$ Y) f* j
  613.       mouse_row = -24 K4 V) n# U, _
  614.     else% f# R9 g  Y# |% Z7 |5 o
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    ; H4 N  b( p1 n" A6 }' i
  616.     end
    4 K: z9 l) e: D, ?( ?) n
  617.     return mouse_row, mouse_col
    / v: f. f2 }' P# _5 `6 B/ {+ M
  618.   end4 Y3 e) q4 k; N$ s4 [$ \
  619.   #--------------------------------------------------------------------------; N, \( ]$ r" \  f7 R
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置: e; U0 b( d6 @( ^0 P' V$ w
  621.   #--------------------------------------------------------------------------, x7 k7 ]  m. C7 v6 \6 M% P
  622.   def set_mouse_pos
    ' z3 h( @8 P+ M4 y6 `: G, V
  623.     if viewport.nil # necessary!  e) k! e* a5 v+ q' c
  624.       vp_x, vp_y = 0, 0! f3 v1 O: O9 O$ C6 v" ~
  625.     else
    3 y' i9 H4 W3 b: u
  626.       vp_x = viewport.rect.x - viewport.ox' E7 N9 f" U4 \0 m+ v, w& u
  627.       vp_y = viewport.rect.y - viewport.oy# K5 [1 n3 k) F$ v+ }. G
  628.     end* L7 G* W0 {7 ]# |# |% H; M/ s
  629.     item_x1 = vp_x + x + standard_padding
    + m) d- P. x- [& N7 m1 ?
  630.     item_y1 = vp_y + y + standard_padding* k8 ^: S! I4 D6 F( }0 M0 |
  631.     get_index = @index  0  0  @index
    4 h7 d" n7 W/ ]' t2 Y" v3 _% [; C
  632.     row = get_index  col_max - top_row0 x+ K" l- J/ B3 G
  633.     col = get_index % col_max
    4 D. b8 y. |+ A5 A9 Q6 X6 C& b6 L+ P
  634.     new_x = item_x1 + item_width  (col + 0.5)/ D# ~! Z0 v. }2 H/ r4 m
  635.     new_y = item_y1 + item_height  (row + 0.5)
    , K- h7 R$ o4 m5 k
  636.     new_x += 14 if col  4
    ' p; o) z8 }6 z
  637.     Mouse.set_mouse_pos(new_x, new_y)
      x2 ^: I" J- h- G/ v
  638.   end- t- a! `) @& f( |. q6 T. T. |  K
  639. end7 q% V( Z% X" }/ X

  640. # Z# Q& C* ?+ D3 v) U
  641. #==============================================================================3 P! \5 Z$ F5 w, p
  642. # ■ Window_NumberInput
    5 \  ]9 x( c+ [$ Y& b- q
  643. #------------------------------------------------------------------------------$ I4 i3 C7 m' G
  644. #  重写了数值输入的方法以适应鼠标
    ' j, f$ A+ v% M1 }1 ^
  645. #==============================================================================8 H4 s& A2 E5 S8 z& R; N
  646. class Window_NumberInput  Window_Base
    $ x' R  ]3 ]# [3 K1 ?$ ~" M  `' c
  647.   #--------------------------------------------------------------------------
    ; a. M- ?% q; z( [1 F  u5 b+ j
  648.   # ● 定义实例变量
    ( h6 M% \  m8 ^" F
  649.   #--------------------------------------------------------------------------
    7 W! g4 o. I' Y. d
  650.   attr_reader extra_window1 C5 H+ N. t& h1 p1 C+ K
  651.   #--------------------------------------------------------------------------
    + [! h/ Y8 c- [  k7 c3 Z
  652.   # ● 初始化
    1 E* {: K7 o% m) G3 L. N( Y' u
  653.   #--------------------------------------------------------------------------
    $ M* N! ?" F! x7 j9 B
  654.   alias sion_mouse_initialize initialize2 U+ U2 e% C8 @% M+ s# `
  655.   def initialize(arg)' w0 d4 Y! @; j  S. t5 O
  656.     sion_mouse_initialize(arg)
    / ~$ L" [( h& K
  657.     create_extra_window
    & _+ s' r: Y( q
  658.   end
    ; X9 H# a# L! a3 Y) ^) Q
  659.   #--------------------------------------------------------------------------
    / H: N: `' @" F% i  i# M
  660.   # ● 启动9 i2 h# N: `4 p1 {2 M8 ?0 c
  661.   #--------------------------------------------------------------------------9 @/ x- k$ k  d8 o# e
  662.   alias sion_mouse_start start/ J% M" G. R9 s+ q1 Q
  663.   def start
    8 c& X6 D3 a! k# R
  664.     sion_mouse_start
    6 G! k2 m& l8 c0 a. a% A
  665.     deactivate
    % l( M; d: r! M& a7 j
  666.     extra_start
    8 W( U' k  H% m( G% l: ]
  667.   end
    ( s- [  [( E1 X  |) Z9 _
  668.   #--------------------------------------------------------------------------/ C) D$ G( }; I8 C/ o! i
  669.   # ● 创建新的数值输入窗口, S, F7 U, z$ B+ C# R( R$ u
  670.   #--------------------------------------------------------------------------9 @% T9 b' O+ ^8 c$ m, `
  671.   def create_extra_window
    2 w7 \1 v0 e- d1 V, D
  672.     @extra_window = Window_NumberInput_Ex.new0 C% M" [! `! k7 |% N* o$ v
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2% G$ N; g" E6 ]  g) I
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }- O8 [7 P' P0 g' d, z% b; p
  675.     @extra_window.index_proc   = Proc.new {n @index = n }/ K+ T# o3 q6 W- a8 t
  676.     @extra_window.close_proc   = Proc.new { close }
    8 V" q5 Z: b# |0 n( V
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    # v- t# y% V5 L! U6 I% J! D
  678.   end! j$ G. Z$ G6 X
  679.   #--------------------------------------------------------------------------+ P8 [' i# ~& w/ I8 U- u# c7 {  Y
  680.   # ● 激活新窗口% Z4 t0 C, {+ {2 ?: u9 W
  681.   #--------------------------------------------------------------------------4 [& F2 g: c- O* r0 @% @( k2 ^
  682.   def extra_start
    $ U6 `4 _8 p, S) R# X6 W0 m7 A# R
  683.     case $game_message.position' K- Y  Y0 I. `; L# T
  684.       when 0; @extra_window.y = y + height + 4
    9 d. B( G- {; ~$ `% j( w* ~1 ~
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 85 h, H2 ^% G. g
  686.       when 2; @extra_window.y = y - @extra_window.height - 4' i$ ^/ V5 T& z: U1 ~7 R
  687.       else  ; @extra_window.y = 8: A  u& K+ P4 M+ d) ?7 G! f/ \7 H
  688.     end
    ) L" F8 \# y/ l
  689.     @extra_window.variable_id = $game_message.num_input_variable_id4 c6 E1 m; `; Z, g0 i* U/ Q$ I
  690.     @extra_window.digits_max  = @digits_max  v8 q! |+ s  H; A; `. U( [
  691.     @extra_window.number      = @number
    % q, r- f9 _7 h0 N
  692.     @extra_window.open
    1 K3 V( I+ U4 J) I
  693.     @extra_window.activate( Q0 A* L6 R, m; |1 @. W
  694.   end
    / Y. l; a6 v# k: Y+ C  m
  695.   #--------------------------------------------------------------------------  a7 i: L4 M$ `: h# p6 s2 G! y- S
  696.   # ● 更新. I' X6 A* M6 M  N+ o3 A
  697.   #--------------------------------------------------------------------------/ F) o& K  {4 d$ A' w3 l5 L0 Z
  698.   def update5 N  T& E# p- @2 Y" e8 H
  699.     super
    : V% k- C& C) G8 A/ f6 S: w
  700.     @extra_window.update- z: m1 g* k0 M2 a: v
  701.     update_cursor: N& _1 f4 V. E
  702.   end
    $ b4 f6 A% p) |/ H$ g/ O6 n8 O5 e. k( ]
  703.   #--------------------------------------------------------------------------
    $ d. Q2 k$ [+ `
  704.   # ● 关闭窗口
    , i6 J) U1 V$ Q  Y
  705.   #--------------------------------------------------------------------------
    1 e8 d' W1 \$ K" o, }
  706.   def close
    1 P, i5 s( Y3 x3 f+ k
  707.     super
    + I: a: C2 z& ~% h5 w/ I
  708.     @extra_window.close
    . P  v. ~5 z. N
  709.     @extra_window.deactivate) E; r- E( @- A
  710.   end( Z% U" `6 G' g) W$ r$ ]! P
  711. end
    7 S1 |8 A0 R. v6 s1 A4 l4 c
  712. 3 T: H( `! O5 n
  713. #==============================================================================
    $ l& ?/ _/ M/ A( L8 ^7 ?: D' J
  714. # ■ Window_NumberInput_Ex2 S! B2 f; P. V$ W8 n: `- t. h
  715. #------------------------------------------------------------------------------
    : Q8 a  V+ j5 \' N' E
  716. #  新的数值输入窗口(NewClass)
    + O1 z6 \6 T! G8 s
  717. #==============================================================================. T, c% @- k& t( X" m( @8 M1 |
  718. class Window_NumberInput_Ex  Window_Selectable3 s8 F8 W+ k9 e( C1 R! a7 m) [4 z
  719.   #--------------------------------------------------------------------------
    1 H1 W/ M. H0 A$ z1 Z. l1 V1 k
  720.   # ● 定义实例变量
      T* i& l8 P; s: g" j- _& F& k
  721.   #--------------------------------------------------------------------------
    . Q& z1 G, Y  ^- I! v6 L3 L( N" f
  722.   attr_accessor number_proc# d$ O. z6 J# R( z) x+ j, B4 L5 k
  723.   attr_accessor index_proc. _" R0 C* {+ v0 f6 A' i6 R
  724.   attr_accessor close_proc
    % c5 b( X" m% r
  725.   attr_accessor refresh_proc
    + _# J( w' \: b) H: I, u
  726.   attr_accessor number
    5 l6 k, W# f4 s2 v7 o5 w
  727.   attr_accessor digits_max
    1 B- i8 g7 z/ {5 f* X4 D
  728.   attr_accessor variable_id: z) }+ [6 v7 e3 P3 y8 z
  729.   #--------------------------------------------------------------------------
    # A% q$ v6 s; ^$ v# J
  730.   # ● 数字表
    0 J9 z4 w; w9 N+ f( f' t; ~9 O
  731.   #--------------------------------------------------------------------------2 x$ J4 z; f3 h  U' {
  732.   TABLE = [  7,  8,  9,# B' D( l0 B' J
  733.              4,  5,  6,
    - l' ~3 v$ [& e- s1 q# Q( T4 u% M
  734.              1,  2,  3,; V/ A4 b$ v( L7 }5 Y
  735.             '←',0,'确定',]
    5 N5 l& h( J+ N- W4 W6 Y
  736.   #--------------------------------------------------------------------------8 n" G* y* j+ v) Q% P
  737.   # ● 初始化对象
    ) ^* m$ p  x! b
  738.   #--------------------------------------------------------------------------# ~- n* t% o- H  w# M8 C1 R
  739.   def initialize" W. c/ @4 a- v- {; ?
  740.     super(0, 0, 120, fitting_height(4))$ n; M: Y6 C. E( o! R
  741.     self.openness = 0
      p3 b& @1 k' s; X7 E) J; O
  742.     @index = 0+ L* s' E& x: @; G
  743.     @number = 0
    4 u/ T; s3 @) U7 J1 [$ u
  744.     @old_window_index = 0
    % ]& s5 _; _/ @, L, l0 j5 @1 Q3 J
  745.     @digits_max = 0
    1 F. ]! w+ C: X# Z
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    1 S2 F( U. A/ Q$ r
  747.   end
    ; r5 y& M$ x; C* Q! P
  748.   #--------------------------------------------------------------------------& `5 c8 i# T& K4 l7 m
  749.   # ● 获取项目的绘制矩形: z8 [, q7 X% s* j; Q
  750.   #--------------------------------------------------------------------------
    8 f6 F/ s. _" o3 H" \
  751.   def item_rect(index)
    2 K3 ?( e) X1 r5 l0 R* g7 X
  752.     rect = Rect.new' n& p1 Z/ P2 g
  753.     rect.x = index % 3  320 _  I2 ^/ M5 G9 X
  754.     rect.y = index  3  line_height7 @& Q. ^: W; H6 p6 B
  755.     rect.width = 32/ v. @4 U; r2 W+ z- \2 H
  756.     rect.height = line_height
    6 p' L: b, X/ u2 H5 S* F
  757.     return rect
    9 z+ P" e3 Y8 Y3 S* F8 Y+ R
  758.   end$ N& F# Z$ e. G/ R) `" H
  759.   #--------------------------------------------------------------------------
    $ ?# L3 ]5 j; \" H9 w0 Y
  760.   # ● 将光标设置到鼠标所在的位置4 S# B+ s) X# V, }4 M# q1 h* A
  761.   #--------------------------------------------------------------------------4 f8 x$ j& A# J5 O7 t, f' E$ W1 c
  762.   def set_cursor. o3 H8 ~9 Q# Y; |
  763.     mouse_row, mouse_col = mouse_window_area4 J8 L  X. |) J' s7 M' m1 s
  764.     if mouse_row = 0 && mouse_col = 0
    8 t6 N) k; Z& W: y4 G6 B2 O% w
  765.       new_index = mouse_row  3 + mouse_col$ i. Y# G+ g( }& I5 w
  766.       select(new_index) if new_index = 11: Q# f2 [  N8 `4 ~: l3 _
  767.     end
    * Y/ X$ q( v) w8 ]
  768.   end
    2 @& D( E5 k( H4 r, }8 F
  769.   #--------------------------------------------------------------------------
    , o- o* F# a% |4 z+ N2 T5 y2 p
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列! x2 q$ e' O5 p/ K
  771.   #--------------------------------------------------------------------------
    ( ?  s% O3 x0 [1 B' U
  772.   def mouse_window_area9 _. k+ P$ u; E# H+ e% r1 }
  773.     if viewport.nil
    6 u; `7 p" f, t% }4 I$ H+ r8 _
  774.       vp_x, vp_y = 0, 0
    . `9 U2 m9 k. m: I) X
  775.     else
    8 s# U+ {" o+ w
  776.       vp_x = viewport.rect.x - viewport.ox9 ?. O  N8 I/ ?3 d7 X. P! m
  777.       vp_y = viewport.rect.y - viewport.oy
    8 Z; J+ P. _: L  J8 T% p
  778.     end
    * H0 b, M) X  R9 b6 }
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y5 d. z/ i$ U) o% Q& C: u$ l
  780.     item_x1 = vp_x + x + standard_padding : S% u9 c% s$ x9 }, w! B
  781.     item_y1 = vp_y + y + standard_padding/ K8 |: }; |: ^1 s. B% f
  782.     item_x2 = vp_x + x - standard_padding + width# j% K! n8 g0 `  w$ j
  783.     item_y2 = vp_y + y - standard_padding + height
    6 X4 C" Y$ p- a0 @5 l  `6 ?7 T
  784.     if mouse_x  item_x1
    * R1 m8 v  B3 o% k8 K
  785.       mouse_col = -1. i" F/ A7 g9 A9 e. N2 \' t
  786.     elsif mouse_x  item_x2
    & R$ s$ F: _% \; `  R5 w
  787.       mouse_col = -2
    " \2 s! Z7 p0 J% j- p
  788.     else: E: g, z* x5 F* |9 y3 ?
  789.       mouse_col = (mouse_x - item_x1)  32
    2 `, L) x- q' b; p
  790.     end7 M( s" @3 z; d7 Q: }. [
  791.     if mouse_y  item_y1/ z) J  I* H& z- e$ b
  792.       mouse_row = -1
    ) b0 A. C1 n, k! I: I" m' p6 y
  793.     elsif mouse_y  item_y2
    ' {# `* r7 o" `2 X( r7 S& e
  794.       mouse_row = -2
    , I+ r/ P5 O# c/ K6 e% ?
  795.     else
    5 M* I; l8 t* n) g: f+ y
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    9 i6 p1 T* e  Y' a( t- m; C
  797.     end2 i( C4 R# J  u- G2 @2 s5 Z- L
  798.     return mouse_row, mouse_col0 r# q/ a6 e/ g% Z9 ~' U
  799.   end
    ) H; ]( U  r; [. H
  800.   #--------------------------------------------------------------------------
    ! }$ l* ]+ L  ]8 X
  801.   # ● 获取文字
    5 `6 o  n, x9 ]5 A, i
  802.   #--------------------------------------------------------------------------+ n, Y; _3 V7 N+ G9 M
  803.   def get_number
    2 W. |6 ~& q1 I& [+ S8 N
  804.     return false if @index == 9  @index == 11
    - a' s  C- l) e) _" l  B0 S# l0 S$ M2 t
  805.     return TABLE[@index]
      ^3 z( H) `# L, g/ X. A2 w& E4 I
  806.   end) y& a7 ?8 e5 X1 ]& y4 U* H
  807.   #--------------------------------------------------------------------------, s! x1 J. [+ a- N- A
  808.   # ● 判定光标位置是否在“退格”上
    " r2 W$ [! Z8 }/ D9 P% p
  809.   #--------------------------------------------------------------------------
    ) f8 k$ \0 t& }% B" y
  810.   def is_delete
    - O# b  p0 f* Z8 `# `8 s0 R3 v
  811.     @index == 9
    : {: Y/ x/ k. H- p& @, L
  812.   end
    - O1 O3 j; ?, z- g# z9 ^  t' o: @, e) R
  813.   #--------------------------------------------------------------------------
    4 _4 U- r( {$ |- t; N
  814.   # ● 判定光标位置是否在“确定”上6 P3 P$ O; u  I2 ]
  815.   #--------------------------------------------------------------------------
    3 e+ O$ s7 @$ `  z
  816.   def is_ok
    % {2 Y3 y7 o7 v1 x' R
  817.     @index == 11
    ' J6 ^7 F2 l5 T' R  ~9 c* Y0 e$ Q
  818.   end
    7 ^3 i9 B$ w7 o, g) D
  819.   #--------------------------------------------------------------------------- p2 b( U% `3 g! v/ e. C7 X+ |
  820.   # ● 更新光标9 G4 O5 u2 \, P' C' Y9 X/ a+ W
  821.   #--------------------------------------------------------------------------! B  a5 j. T' P4 P2 ]8 ]) \
  822.   def update_cursor9 M. k8 D9 w' i2 m, L
  823.     cursor_rect.set(item_rect(@index))4 g% ^1 V$ G7 t7 M' s
  824.   end
      P8 h( T  V5 C
  825.   #--------------------------------------------------------------------------" T  d+ R# E2 `; |8 @8 l
  826.   # ● 判定光标是否可以移动
    : ?: W& f7 ~2 |
  827.   #--------------------------------------------------------------------------
      O* h$ \8 |8 H
  828.   def cursor_movable& b% d( L9 j( R0 S% A; S
  829.     active  B; \/ t6 R9 e7 T  `
  830.   end
    + {# P. E1 U. H: H
  831.   #--------------------------------------------------------------------------% e2 k8 y0 m/ v& [1 u; k8 @6 a2 _
  832.   # ● 光标向下移动
    * \6 m% B8 \& P9 [* g
  833.   #     wrap  允许循环0 D6 p% j" t7 ?( Q. f2 E1 W
  834.   #--------------------------------------------------------------------------
    0 k5 Y* r& T* u; ~: i6 k% Z( h
  835.   def cursor_down(wrap)
    : S8 t( H8 M8 }! V
  836.     if @index  9 or wrap3 a7 e, [) G; `8 G7 q. P, L8 ?7 Z
  837.       @index = (index + 3) % 12
    4 r3 ?+ [' u4 q3 }9 p
  838.     end/ @  J0 M3 q) X& ~4 q$ q4 @
  839.   end
    ) W7 w0 i% l% e3 {" p
  840.   #--------------------------------------------------------------------------( P8 d/ c, w( r" h3 W6 O
  841.   # ● 光标向上移动- a& ]! L) \! U, ^
  842.   #     wrap  允许循环
    ! w# g; j6 A) t/ ]0 b% [+ s8 G, ?
  843.   #--------------------------------------------------------------------------
    ! l! J1 `# S4 y8 ~+ _
  844.   def cursor_up(wrap)
    " x& R9 \9 J. u) [4 z2 `
  845.     if @index = 3 or wrap
    / n% _# r  c/ j& u' \
  846.       @index = (index + 9) % 12/ e8 d. A1 D$ y* G6 Z7 T
  847.     end+ |3 a, ^+ P3 {; `; u
  848.   end
    * o+ H3 s3 i4 Q& P- f! d  _
  849.   #--------------------------------------------------------------------------
    ' W! v2 {) E" V1 K7 Z
  850.   # ● 光标向右移动
    6 Q' o) u/ y! c* B* a1 z
  851.   #     wrap  允许循环( l$ N/ N1 W9 ?0 p1 l: t4 j. t
  852.   #--------------------------------------------------------------------------
    / C( V: o, {! N
  853.   def cursor_right(wrap)
    2 |# n! U& F2 B7 i
  854.     if @index % 3  2
    1 ^# S! e' f) w0 W* x
  855.       @index += 1" ]4 V; [" B- p
  856.     elsif wrap# d- a8 {& v/ n
  857.       @index -= 2: P1 {! ?. u; ^) O3 Q6 _7 e
  858.     end
    & @; ^6 X# H$ t$ V: b, {; b; I
  859.   end/ J8 l3 L; L$ I
  860.   #--------------------------------------------------------------------------
    . h  }9 d# b) W6 T( ~1 H5 N
  861.   # ● 光标向左移动
    # I) w4 G. e' ^2 K9 k% h' k& S. A% A
  862.   #     wrap  允许循环( v& u/ M* j) H! x* Y4 G: C
  863.   #--------------------------------------------------------------------------
    7 @2 }! h6 b6 Z4 Q& L+ X+ i" H  T& ]
  864.   def cursor_left(wrap)3 i9 q5 D& N+ d( `8 X( b" V
  865.     if @index % 3  03 A8 @9 e- }5 e2 e7 c5 V
  866.       @index -= 1% W1 s0 Y7 V8 H8 F9 e- j( R
  867.     elsif wrap( c/ S9 T0 o- _) f! `4 d
  868.       @index += 29 s- B4 Q7 r5 l# k' A9 P' l3 u7 w
  869.     end  b" `9 v( \3 o; h$ F# z( Z$ h
  870.   end" f. t7 k7 R% M8 S4 M
  871.   #--------------------------------------------------------------------------4 B- H# l* p* O- c0 }, t
  872.   # ● 处理光标的移动! `8 Y) ]* W  x2 _5 o, H0 g, o1 F
  873.   #--------------------------------------------------------------------------
    % o- ~, Q4 r* b5 Z+ _
  874.   def process_cursor_move
    : V5 @  r$ p5 ^' q: X4 T
  875.     super7 w0 ^; b2 E4 k$ Q7 x; ~# h
  876.     update_cursor8 C. q* e* B# R0 [( J$ H; ^
  877.   end
    # ?3 z# L( [6 m: _; y0 m9 i) i
  878.   #--------------------------------------------------------------------------. v2 }/ F, y0 S" r: J
  879.   # ● “确定”、“删除字符”和“取消输入”的处理7 Y  C) `! h9 f" f  U
  880.   #--------------------------------------------------------------------------
    0 f' h; P" d1 Y* n8 z8 ?  a+ L
  881.   def process_handling2 L/ T- _" \# L( b& l
  882.     return unless open && active
    . z  J) ~0 X8 B3 e* K
  883.     process_jump if Input.trigger(A)
    1 O& V7 ]) ~  C6 z  h# v- ?
  884.     process_back if Input.repeat(B)/ H! @! M% ^# f2 H+ [2 g, C. W
  885.     process_ok   if Input.trigger(C)7 B1 t* c% i$ `9 \8 _  c
  886.   end0 H0 s1 V8 W. {) r  T
  887.   #--------------------------------------------------------------------------- p8 i; K2 r, Y9 Q, E( u
  888.   # ● 跳转“确定”; I9 \$ f2 a! k( Y
  889.   #--------------------------------------------------------------------------! o5 x" H* I, n9 H# m9 Y
  890.   def process_jump
    1 X' P- c; H+ J" l  Q* v
  891.     if @index != 11- W+ a0 h$ U0 X, v8 V
  892.       @index = 11
    0 |: q; g' D0 h& I! Q& P+ ^, P1 ]
  893.       Sound.play_cursor: M; @* T% N/ J$ s& n
  894.     end
    2 j! c- V+ @9 t& l- r
  895.   end
    9 t. f* r7 a8 e
  896.   #--------------------------------------------------------------------------
    3 P' K( ~  c; g# ^! H2 N3 s6 l! Z
  897.   # ● 后退一个字符
    # m# {+ m6 L6 i
  898.   #--------------------------------------------------------------------------
    ( S0 F  @% ?0 _) ~8 j# p3 u: @
  899.   def process_back0 ]  ~* @4 f" H6 g
  900.     Sound.play_cancel
    2 Q8 ?5 b! w( \6 X2 Z9 P
  901.     place = 10  (@digits_max - 1 - @old_window_index)2 B7 V- j8 e# E1 P6 f0 _
  902.     n = (@number  place) % 108 R6 |5 k% Y5 g% s
  903.     @number -= n  place
    8 A" R/ Y: N# y4 u6 [$ y8 ~+ Y
  904.     @number_proc.call(@number)2 I- o( ]/ u' D! _* w2 r
  905.     @old_window_index -= 1 if @old_window_index  0
    1 F( N' W7 C+ h, s% O% s
  906.     @index_proc.call(@old_window_index)& b; w5 B+ H6 F
  907.     @refresh_proc.call
    9 O. ]& D2 A( T% J8 {+ ]
  908.   end2 D5 o7 g5 f$ D$ q" b0 `
  909.   #--------------------------------------------------------------------------
    + |8 z& @% G. C* y
  910.   # ● 按下确定键时的处理
      E2 ~4 z; j, p: J- Y3 `5 A; m" E
  911.   #--------------------------------------------------------------------------
    9 _3 J) T2 b, o, _& F7 u
  912.   def process_ok* T; e  b4 D! s1 I6 p
  913.     if get_number
    - q" K0 b7 H+ H7 ?) p; M
  914.       Sound.play_cursor
    2 q; M5 M5 Q5 A% d1 A
  915.       place = 10  (@digits_max - 1 - @old_window_index)  S4 g3 u$ \/ Z3 C0 k
  916.       n = get_number - (@number  place) % 10, H2 W# F6 }/ X
  917.       @number += n  place
    " z/ q% K; \, l, ?; M
  918.       @number_proc.call(@number)& Q5 G1 o8 \% s1 \$ V8 p
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    1 o  P: e$ |+ Y" o8 N% Z5 j
  920.       @index_proc.call(@old_window_index)
    / L5 U  b4 a' O$ u1 D- w
  921.       @refresh_proc.call# F, W' s* S/ {9 g" d/ O  Z% m
  922.     elsif is_delete5 u- ^" w+ {) ^% C
  923.       process_back$ J& E- R9 Q* o3 S' [! ~8 G6 Q8 W
  924.     elsif is_ok# O0 h5 d/ F. k* W& _; @/ i
  925.       on_input_ok- l. j+ p& t) K( i
  926.     end
    3 X5 i# G7 J+ w* N# z8 `
  927.   end
    . }9 D7 h8 S; y- U) x
  928.   #--------------------------------------------------------------------------# u" ?6 a4 ~0 c" l
  929.   # ● 确定1 R' h2 c, D' E. ?5 G2 ?+ ~
  930.   #--------------------------------------------------------------------------. {; x! I' ?! p9 @% |
  931.   def on_input_ok
    * d$ z/ k1 _  ]2 d5 T8 \! q4 n
  932.     @index = 0
    0 O/ ^0 F+ N, E
  933.     @old_window_index = 0
    ) u1 `1 R! j& G  p. V
  934.     $game_variables[@variable_id] = @number
    1 j) A- o/ {3 G+ P+ _# L7 T
  935.     Sound.play_ok7 L3 j; y  X1 h: o0 {+ l
  936.     @close_proc.call% \* b) S2 ~" S, l2 g) H
  937.   end6 Y* T" F, w: r/ v; Q
  938.   #--------------------------------------------------------------------------5 F+ S1 R! }( f9 E9 l
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, s( B! [- x. k) G( K; Y4 s0 v
  940.   #--------------------------------------------------------------------------
    ) c+ a9 Q+ P7 s6 v# [
  941.   def set_mouse_pos
    , t0 w% K7 }$ c. j  v  ^5 K" _
  942.     if viewport.nil # necessary!, \( J& L' k% R  G1 u8 n) i. P
  943.       vp_x, vp_y = 0, 08 m* `9 \( m. q1 E! @
  944.     else3 m  [  L  A9 e% t& @8 q1 L
  945.       vp_x = viewport.rect.x - viewport.ox
    9 Y4 D7 B7 s: u7 \: n) L
  946.       vp_y = viewport.rect.y - viewport.oy
    . Y7 C" z3 q/ }3 H" w) m0 H
  947.     end
    , X# ]0 r2 o, S2 b1 u8 R
  948.     item_x1 = vp_x + x + standard_padding ! L( [6 Z) G& N) d5 A
  949.     item_y1 = vp_y + y + standard_padding! E1 _2 A5 a4 Y3 n1 z, x
  950.     get_index = @index  0  0  @index 4 p  f5 q6 S' v  g9 v
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)4 T5 j$ R( y; R9 X# g# d% Y
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    ( m3 F" }4 _, ~# i) _
  953.     Mouse.set_mouse_pos(new_x, new_y)( m9 w  |1 B8 g8 F# r
  954.   end
    0 {+ _% {& O- m
  955. end
    ) N1 h$ F' o5 r" j6 M

  956. % [+ ~9 P4 S, O; U4 @1 D: ]
  957. #==============================================================================& K. u* U" n; G3 k( J
  958. # ■ Window_Message
      O' ~; ~6 x+ |2 q
  959. #------------------------------------------------------------------------------
    ' B& _; x4 T3 }# a& |, {
  960. #  显示文字信息的窗口。0 l& C: G  A# ^' M# M: Y1 N0 }0 M. E
  961. #==============================================================================- C" H: D7 t* ^6 _
  962. class Window_Message  Window_Base
    * O/ u* {4 _0 U$ a  O
  963.   #--------------------------------------------------------------------------
    * t8 M* n2 {3 |4 x; L' D" S
  964.   # ● 处理数值的输入(覆盖原方法)
    $ U0 f4 [" _$ d+ a, M
  965.   #--------------------------------------------------------------------------% N* @9 J* u+ a9 P7 l
  966.   def input_number
    7 x9 y* v6 G5 Z4 \4 e( i+ @
  967.     @number_window.start2 ^  r6 k1 \/ H( k
  968.     Fiber.yield while @number_window.extra_window.active
    " y' \6 ?8 E9 r2 H2 n: m+ u
  969.   end
    1 s) D0 E1 [# N, f5 A
  970. end7 L5 m( H3 S: h

  971. : u% F, Q  A/ _8 b/ y* k* j
  972. #==============================================================================
    % e" b7 a9 d& |& U4 H+ Z# q+ A
  973. # ■ Window_PartyCommand
      x7 v$ S0 ]: Q. @
  974. #------------------------------------------------------------------------------* d8 V/ J' z: |$ ~) e
  975. #  战斗画面中,选择“战斗/撤退”的窗口。5 ~1 x# k8 p) i/ i' d8 _
  976. #==============================================================================
    & F! ]" E1 j0 d, Y
  977. class Window_PartyCommand  Window_Command, f' Z0 e; B+ ]/ @
  978.   #--------------------------------------------------------------------------
    6 _) {+ f/ l# v
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ; o5 G$ L7 @* _; m( Y1 i4 X9 g, N8 b$ Y' n
  980.   #--------------------------------------------------------------------------  V* M/ A" E" Q) Y9 w. A5 E9 T
  981.   def set_mouse_pos8 `' ]( \* `1 Y0 j' n
  982.     if viewport.nil
    8 O9 O; z4 E% M! {+ e
  983.       vp_x, vp_y = 0, 0
    9 [' H6 Q' ^9 p2 g$ S
  984.     else1 R* M. a2 X$ w4 @! k8 u( }
  985.       #vp_x = viewport.rect.x - viewport.ox
    " O  T# X" \# H) K2 X: [
  986.       vp_y = viewport.rect.y - viewport.oy1 R9 t# O6 J. E, n# ~
  987.     end
    # Q- Z9 Q3 i; a8 o6 @7 I
  988.     item_x1 = x + standard_padding % Z! z# S% |& d' r: z" V2 O
  989.     item_y1 = vp_y + y + standard_padding
    7 f7 U2 K- h" U9 e. x7 O, O
  990.     get_index = @index  0  0  @index ( O3 y( S) ^7 _6 N' F: q
  991.     row = get_index  col_max - top_row, W" l% O4 o3 ~: S0 _: E7 H
  992.     col = get_index % col_max4 Y, U7 \: ^5 m7 w% L2 [9 q0 o* ~
  993.     new_x = item_x1 + item_width  (col + 0.5)
    2 N6 F2 g& B9 G& L8 n3 [
  994.     new_y = item_y1 + item_height  (row + 0.5)
    ( C" M1 p+ N# O/ E
  995.     Mouse.set_mouse_pos(new_x, new_y)
    ' I, w3 w0 t2 |# ^  L$ `0 B* J
  996.   end. T: g( F& }% ]- t- {' U. T
  997. end
    % P  g, ^' G$ B( b

  998. 6 E5 t! ]0 w* ~/ @0 p
  999. #==============================================================================
    " X' u+ G2 R, f
  1000. # ■ Window_ActorCommand" S2 a8 r9 l4 l6 l
  1001. #------------------------------------------------------------------------------
    1 F! x! x/ K! S3 f& u3 ^$ g
  1002. #  战斗画面中,选择角色行动的窗口。4 s6 E, k. W, [9 Z
  1003. #==============================================================================# n, l( m, B, l! e
  1004. class Window_ActorCommand  Window_Command
    & q2 _* V% E0 g, U7 D6 h
  1005.   #--------------------------------------------------------------------------6 C4 J( F6 L6 T. R+ y0 @
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置# `. N# y$ g( k2 f
  1007.   #--------------------------------------------------------------------------
    4 W- k# a8 i& P% E$ o$ I* K- I" E
  1008.   def set_mouse_pos
    3 q% t7 x3 @6 Q6 ^3 o
  1009.     if viewport.nil
    9 u1 }/ u7 b9 _0 r$ k
  1010.       vp_x, vp_y = 0, 01 w: N: e" R9 b& k- ~# E6 O3 N
  1011.     else
    ( E# |" s* t) q9 o: o3 }
  1012.       #vp_x = viewport.rect.x - viewport.ox
    ( U. j2 d  _* B2 ^9 K6 ^3 j/ S1 `
  1013.       vp_y = viewport.rect.y - viewport.oy
    5 H  V2 \, @4 J! S. O% E7 s
  1014.     end
    # A- c4 ^, }8 c0 d" f! u
  1015.     item_x1 = Graphics.width - width + standard_padding# h. C5 ~* U, K' T: Z3 P4 ~
  1016.     item_y1 = vp_y + y + standard_padding9 V8 D! P1 }; N+ E3 C" Y/ {& \8 i
  1017.     get_index = @index  0  0  @index 7 \* @) i, q" u* g5 B; F" d
  1018.     row = get_index  col_max - top_row4 R0 e2 \' j9 x- V. a8 a
  1019.     col = get_index % col_max
      r. h/ s; n1 c$ ]' ^0 E5 l5 M
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    7 E6 A: L# X3 }  Q* o
  1021.     new_y = item_y1 + item_height  (row + 0.5)7 |' B% J6 U* l9 p5 I7 t
  1022.     Mouse.set_mouse_pos(new_x, new_y)( M  ^* m/ O# F' [0 d3 R: V
  1023.   end0 q3 i2 r9 r* L5 ~
  1024. end
    0 W  F1 m. o2 Q# `' r0 e

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

  2371. 1 Y) H* c1 N1 `1 X) Q2 \, M: U6 C
  2372. ####泥煤的height+ S, H/ ~; m' [# R. @
  2373. # @height = height" S" `9 h1 |7 h% R
  2374. - O% v' E% `4 l8 X* R5 |  a  d
  2375. class Area_Response7 [" W3 V2 G5 x4 s7 W
  2376.   attr_accessor type
    - W5 L$ b5 c" H2 _; G$ ~5 w
  2377.   attr_reader ox: S: H1 ?4 l4 {- G/ N
  2378.   attr_reader oy6 I3 ]+ D# l' {
  2379.   attr_reader width
    7 }( ~1 j8 x9 i8 m/ L+ Q2 u8 ~: n
  2380.   attr_reader height8 B; R* b2 t8 o& G4 E8 q# i
  2381.   attr_reader switch_id
    / {9 S6 ?, [1 y: K8 [; u+ W
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    - C0 ]2 A/ y1 [: h  k' P
  2383.     @type = type5 w0 ]* J7 s* @$ ^
  2384.     @ox = ox
    2 V2 c& X. U8 K! {" `( H  t% F
  2385.     @oy = oy
    ' [8 T& j/ o3 a+ U; d1 X
  2386.     @width = width* N( h% y6 h; H
  2387.     @height = height& Q/ v$ l) j- C; R8 g* S
  2388.     @switch_id = switch_id# [: G5 B8 O4 h; U- Y, G
  2389.   end
    6 V# a! O7 T9 X& Q. V
  2390. end
    6 O) }" M4 {8 O$ T
  2391. ; |6 J$ B2 g0 V) C! Y% i! Y0 Y, p
  2392. $area_responses = []: c: [, Y% `" }. O0 p# ~" M' k

  2393.   D$ C, a4 o/ x9 r) H2 r
  2394. class Scene_Map$ J! S! v6 s- B- u+ S) Q
  2395.   alias update_mouse_2013421 update_mouse_action
    0 c; y* P- r5 F' S; }
  2396.   def update_mouse_action% t6 V+ Z; R- B# l' A: {
  2397.     update_area_response
    1 A- U6 Y7 P( y% U/ S
  2398.     update_mouse_2013421/ I  ~. F9 z0 p
  2399.   end! m" w% Z, Z$ ^7 ?
  2400.   def update_area_response
    * H/ Q& \* \, ?; z9 @; k: x" R" ]
  2401.     responses = $area_responses: q) v9 {% t9 r5 h9 M2 ]- j+ u$ U
  2402.     responses.each {response
    1 e( l; R! S5 F2 g& ?7 w
  2403.       ox = response.ox
    1 d' A: C9 Z/ x
  2404.       oy = response.oy
    0 t0 t# x; X5 Y6 z& i' q6 I
  2405.       width = response.width
    ) h( O+ r; k8 k# N4 c7 U+ I
  2406.       height = response.height% F7 O; w: k: f8 z- g0 B' D
  2407.       switch_id = response.switch_id6 K, A& E& u1 d$ b: T8 Y
  2408.       case response.type& d+ ]& ^% O4 N; C# C+ ^+ `$ b; ~! r
  2409.       when 03 D( P) b3 M0 _8 T( S% I
  2410.         if mouse_in_area(ox, oy, width, height)2 ~- u; Q. A% I3 X; E3 b* b6 y: m8 p* s, \
  2411.           $game_switches[switch_id] = true& c- A4 K1 ]5 X) E
  2412.           $area_responses.delete(response)
    6 J7 F# I+ B) ~; H
  2413.         end- G/ U5 ~' X% v
  2414.       when 1; K: F, D( j+ X4 c; J% G5 p
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)" l  k$ J/ W7 O( b
  2416.           $game_switches[switch_id] = true+ |3 a* G  O0 C$ q% ~% M3 K
  2417.           $area_responses.delete(response)  n: r# i. Q/ r+ O2 E9 ]
  2418.         end
    6 M  G) `. Z$ L& J# Y
  2419.       when 2
    , V; s, I( L8 {) H$ Q
  2420.         if mouse_in_area(ox, oy, width, height); B9 R2 E. Y( x# ^# ~8 M+ c
  2421.           $game_switches[switch_id] = true5 m2 q. i+ v- i! b. P# Z, c) K
  2422.         else
    1 N. S$ D% _. h; y
  2423.           $game_switches[switch_id] = false
    1 U$ p* R: b. w9 I! ^
  2424.         end
    $ Y7 E3 r! s* Q, m+ y8 |
  2425.       when 3
    2 A6 f2 F! L' ~# W! h! U7 C* u
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,: T  P2 W3 e$ W2 \$ X  V; O' F
  2427.             (oy - $game_map.display_y)  32, width, height)5 |8 `: k" Y$ Z4 O2 x& w
  2428.           $game_map.events_xy(ox, oy).each {event
    3 Y  O  j, o) n: r+ L
  2429.           event.start
    8 r% l6 }7 o2 x; t" j6 H
  2430.           $area_responses.delete(response)
    ' ~6 m7 ^3 o- q9 k+ e4 o2 @
  2431.           return
    0 n1 Q* V+ m; @( Q" N* A! M
  2432.           } 5 L. d, U0 o& O# e2 [3 m
  2433.         end
    - P$ D% l- W4 z% w! [# y! j+ q
  2434.       when 4% c: l. ?9 f) ?7 `! m
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    1 S! Z, j+ R' v% M$ P" t
  2436.             (oy - $game_map.display_y)  32, width, height)
    . t+ {6 c' L8 O5 b4 Q0 W; C
  2437.           $game_map.events_xy(ox, oy).each {event
    5 ?! i  m! |) A3 U2 Q' y
  2438.             event.start
    . J6 H5 v7 E2 j# b4 s* r
  2439.             return2 x/ c" @* t' c
  2440.           }
    0 V! t# Q5 l" r1 T. p& \5 a7 A
  2441.         end
    0 H8 J9 H  R6 r! ~
  2442.       end
      r8 }8 g: [  \) Z) S  e: U
  2443.     }8 A' {0 n1 o* g# B1 t
  2444.   end; ?+ Q* l  `& l0 o# b3 N( M
  2445.   def mouse_in_area(ox, oy, width, height)' j, |+ i* |* E- ~2 A5 j) o
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    3 l% y9 J% S8 h# Y
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height, u3 D  l* |4 y( z  m. R2 V
  2448.   end6 y2 o" \5 B  v" D
  2449. end
    9 b6 l8 @3 R1 h4 k/ Q' H, x7 m
  2450. class Game_Interpreter
    - i% l- h- R2 p& [2 G/ b; d
  2451.   def area_response(arg)
    ) Q9 @, ?6 c4 x) W% E0 h2 }
  2452.     $area_responses.push(Area_Response.new(arg))$ }7 a* o: ]- j$ H% _; q% `; V  L* q
  2453.   end, ?% U/ U+ t2 M# Q9 U2 F
  2454. end
    & r1 m  w0 e0 h/ F6 }9 w  T: A
复制代码

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

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

GMT+8, 2025-2-20 04:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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