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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    / l; I3 v+ o& t5 W; x; p: \+ K
  2. / o. N' u- l) a' d7 e- O
  3.   Sion Mouse System v1.3e' U* Q3 i6 \% O5 z2 l
  4.   
    ; ]5 B; T8 ^6 u, Z" j& Z/ ^
  5.   Changlog
    # |5 g( j/ _! i3 F. ^2 f
  6.   5 t7 t5 j& _; A! {7 ?* `
  7.   2013.4.21 v1.3f8 w9 v* f" Z0 l
  8.     6 H4 h8 r0 U/ ]9 ^7 M
  9.     1.3f 卷动地图 bug 修正
    2 z# n% X2 h5 n3 M$ N! a
  10.    
    0 w7 q# |- d& o, b: V
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口/ _4 G/ F9 f4 V4 [
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    3 ^8 }/ n' i1 t' J
  13.                               Mouse.unlock_mouse_in_screen 解除锁定& j$ \  }/ m: e3 @1 L; W
  14. 2 \- M) T7 h4 R$ b
  15.     1.3f bug修正
    9 G% W( [6 X( y+ {
  16.   
    : t4 I6 t; M$ J
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及" z7 ?% V  w# z* V' Q) x
  18.           关闭菜单时,鼠标是否移动到原来的位置。5 `4 S. k4 }: c, _9 @- e# n
  19. 2 y; W, |2 k5 C2 f9 `! l
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处# U0 F3 ]4 {& m
  21. : @2 g3 Q; ?) p8 d: Q
  22.     1.3b 修正一些罕见的bug;: n" R% K; s9 l
  23. ( r! X% n% {! H, [
  24.     1.3a 代码小修改;
    / E% `3 y) V  e' c& g4 T9 ?/ o
  25.           加入了鼠标点击启动事件的功能,
    & }# U9 H1 r  n  B# }) Z( ]
  26.           在事件中加入“注释”: 鼠标启动  ,
    % d2 ?' W8 h7 U
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。3 C/ H6 ]9 X* @# O
  28.   
    . D& L0 \1 V. h3 l
  29.   2013.2.12 v1.28 K6 p5 x/ v' M' p  F/ t6 K! m
  30. 3 Z9 q$ O( L- G
  31.     寻路逻辑优化;+ z% B- z4 a" A6 [5 }7 j
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    ' I- C. V- I( e+ n# R9 K6 U6 }
  33.     现在支持用鼠标来操作载具了。+ D/ M+ d; R( j2 i$ n/ C
  34.   R) O6 `! A1 ~2 V5 C' Q. @+ O
  35.   2013.2.8 v1.16 n: ^+ Y% l9 [" I5 e# |6 Q

  36. : G& q3 t0 o7 \# j8 `
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;1 y; C& J, M2 t0 E* s
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    " X) G& [" r0 s' o7 D. K( B
  39.     移动时,路径指示点的绘制更加稳定;4 n' z% ]! O% {
  40.     现在支持默认存档画面的鼠标操作了。
    ; S% F9 x, d! ~9 ^/ Q2 A3 r+ b5 d
  41. 6 ^& k9 L  T& Z% h6 I' \- L

  42. . ]& R( g3 r5 f4 x* G4 [
  43.   OrigenVersion
    % a8 K8 T6 q2 [# K7 {" h) t% A
  44.   7 R. G/ V7 q- S( `* a! L
  45.     2013.2.7 v1.0 % B! y3 Q. [# ~5 G7 d+ W

  46. . E8 e% M1 J" w. a  L
  47.   主要功能
    , k* ~( [6 k* A7 U8 j7 H4 g6 Q

  48. - N# Y: r0 Q. m% f; B
  49.       使用鼠标进行各种操作...* E9 o# n1 p- ^% ?3 V0 ]
  50.       将鼠标锁定在游戏窗口内
    & q# }9 O2 V4 O3 t$ P
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    ( j# J  @) Q2 e; F, W
  52.       双击鼠标进行冲刺
      m! q' {( |) Z3 ~8 v+ x$ m  t
  53.       更改地图卷动方式以适应鼠标移动8 j1 R- i! f/ [9 c/ f
  54.       变量输入框改良, t, N8 n0 t- @4 ?; K% |. t

  55. - J0 s' @- c/ R
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹8 j- z' `5 `& x

  57. # p8 X0 z3 C" ]+ t# g
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    3 F8 ^- J6 @: [$ \! T

  59. 2 b- N+ u- g( L$ R9 ]) o& s
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭. l% L1 L2 M! N6 V* p
  61. 7 P  Y( W% g+ e9 i1 G" {

  62. ( a1 j% o; W1 C& n' ?
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★5 E, o( ?# ~: Z% \

  64. ( s7 R3 ~' v' I

  65. ( X3 |8 s8 J* @# H6 U
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    6 J/ g) z' {5 `; a9 y% e

  67. ( x) K! }9 Z$ Y9 P2 n) {1 g
  68. #==============================================================================) ~, [/ c/ o: i+ A' _
  69. # ■ 常数设置 ) Z; G( r7 S) Q& ]: z( d
  70. #==============================================================================
    . Y9 w) A5 r( X" F5 l& e2 _4 M
  71. module KsOfSion! E1 \* w6 C3 j. g: d  ]
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false) U' T& H. u* O. h" a* s) W" [: [* ^
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    / Y% s+ f; b( l" k  U7 ~0 }
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    : [! Q( C; a! L2 \4 \( L
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    4 D- h# |% x4 ?. y
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ; @1 H4 O2 \$ d& w* t' V, |% I
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧; \6 v- p' i2 D# w* s4 F
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)9 o2 [4 ~) r2 R3 |! H
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键, ^) M0 W# w9 [. A, C3 H
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    1 W. O9 |4 C" I: \
  81. end/ I4 ?! R3 R+ A9 j/ _: @
  82. $ F  T/ g: n+ K. g9 z8 x( }) v
  83. #==============================================================================
    1 i: s  A, [( Y6 f& T7 m
  84. # ■ 用来显示路径点的类2 G# i( y" f4 `1 ~' Q
  85. #==============================================================================
    7 y) i' O2 J/ l1 c: b3 J
  86. class Move_Sign  Game_Character
    $ V- p3 t5 Z0 k2 ^; a: s
  87.   #--------------------------------------------------------------------------0 `, j- m( P# F) e, A
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图; u7 K4 G. q/ C
  89.   #--------------------------------------------------------------------------! x" L& x/ Q& T0 ?1 A) z* j
  90.   def init_public_members
    0 a/ q( r4 {2 g3 `9 j" l
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    : U! s1 q& S/ e% I
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    # a/ y, [* n5 e% V) Q
  93.     @move_speed      = 5        # ★ 踏步速度
    4 d5 I6 k  Y3 S8 i8 _! t  A/ L. ^
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    3 A8 F% |2 m+ m9 x2 n! U7 O
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    3 i" i! J6 T* a, \. q0 Q9 S6 C, K
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    $ W$ S- R* _8 A2 S' o  E
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列, Z" t. R0 b; s
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)% Q3 q) Z- D  k8 p- o9 o

  99. ! v6 B; Y. t' ]* O- R$ J
  100.   h6 Z9 h4 n% K$ [5 X2 h
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★8 w) e- F' J( }! G& X: H
  102. 1 l) Z) F. ~9 e
  103. . Y) [1 U2 U  Z3 q! p7 ]
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图. x% Z- e8 v% {" H
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    " N1 p) ~+ _& G+ p* M; G

  106.   o0 y; j5 ^- p8 A
  107.       if $no_arrowpic_warn; ^; F" \2 X+ u6 d( B# b
  108.         MouseShow_Cursor.call(1)+ b7 b% T1 ^# ~, L0 T. f
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png# }* ?6 X$ M; j8 C5 f
  110.   P. i0 Y& Y2 V
  111. “路径指示点”将使用游戏自带图片9 Y' u9 s- d3 D# g! I8 b

  112. & |' ^$ W6 l: [) L" }$ A6 m4 `
  113. 该提示可以在脚本内关闭')
    4 F. V) [: ~0 r$ a) I6 n
  114.         MouseShow_Cursor.call(0). r5 c; a  z9 Y2 w6 y% d1 b3 \
  115.         $no_arrowpic_warn = false
    5 Q3 y# t: ?& A, S5 J
  116.       end( T% J; Z8 m+ k2 w- j- M4 ?
  117.       @character_name  = '!Flame'' f/ |+ P' q5 g! A# L$ c
  118.       @character_index = 6
    7 e+ Z8 n& h/ N3 i2 B3 k
  119. , X4 f: `1 p9 n6 P% f
  120.     end' H# q; m+ o  x' M0 t  P. `! e
  121.     @direction_fix = false  # 固定朝向
    ' W9 L1 o( Z, _& V
  122.     @move_frequency = 6     # 移动频率" A, {7 ~5 K8 O( ]5 m3 e
  123.     @walk_anime = true      # 步行动画
    + o4 {( G3 N$ a3 R
  124.     @pattern = 1            # 图案  h/ {  h8 E/ L7 c
  125.     @through = true         # 穿透; e# f: u+ e" u5 r: b) ^
  126.     @bush_depth = 0         # 草木深度
    3 O6 r% i/ Z( @2 E( k
  127.     @animation_id = 0       # 动画 ID
    . m% J) ]. u/ S
  128.     @balloon_id = 0         # 心情 ID
    ' \; F* Y$ j+ C# k. D. n
  129.     @transparent = true     # 透明0 Y" a& [% i2 ~, X* }% k7 }8 n+ W8 l
  130.     @id = 0
    + H6 K) K  E0 s2 b% p
  131.     @x = 03 H- @  ~: M0 S8 g3 }
  132.     @y = 0( Z# E5 Y1 k, J' M* R* k
  133.     @real_x = 0
    * M, K- j: O  l: S7 f, @7 t
  134.     @real_y = 0
    $ L. w1 i" k) Y
  135.     @tile_id = 02 W; l- @* w; t  M' \2 _; b5 g
  136.   end
    * K: \$ m# a' t: K
  137.   #--------------------------------------------------------------------------
    0 p) J% r0 O5 S# {, m6 b: f3 O9 `
  138.   # ● 定义实例变量
    ; ?9 w* @0 y) v; V5 s6 B( X
  139.   #--------------------------------------------------------------------------
    - F5 g! E9 X0 H; k
  140.   attr_accessor direction
    " G- B; R8 X: u) a0 q3 K0 {, R
  141. end
    " F; u5 Q  X' D

  142. $ O! v7 I7 P8 }" O0 Q
  143. #==============================================================================
    / ~* q4 Z! {$ K  A7 M8 ~9 K  h% D1 `+ B
  144. # ■ Module Mouse  ]5 B# z" c' a
  145. #==============================================================================
    0 x1 Q1 M6 m+ v) q! c
  146. module Mouse+ d( M) {5 s* r& N& @8 ?' l- z
  147.   #--------------------------------------------------------------------------- a1 c# ?/ [, C* G( {
  148.   # ● API
    - ]) O) u$ S+ U& g5 A+ {
  149.   #--------------------------------------------------------------------------
    4 o# Q, f9 |% s: j) M3 V, s
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    8 D$ H' Y+ t7 {8 p8 Q7 X
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')  s+ s8 G. o) p: v- m
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')* P2 j, r) j; C+ N
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    & y/ ~4 o+ ^, k7 f- |0 ?
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')0 w2 v/ y' l$ b, k
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    " P" Z  O" Y0 \
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')/ J9 j; ?& B3 ?2 L# x1 b
  157.   Window_Hwnd       = Get_Active_Window.call
    $ A  P  B$ I" _' w

  158. 8 b" y8 {# `1 Y# `9 p4 y1 K
  159. class  self4 p. j1 E* V1 ?4 Y$ \4 H! j3 n
  160.   #--------------------------------------------------------------------------
    6 U# \0 S2 _: }# Z
  161.   # ● 初始化  W9 ?( P4 P* s/ a: B
  162.   #--------------------------------------------------------------------------8 ?. J$ W3 H2 c
  163.   def init) B: j- V  {; e
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    : ?$ o: D) A! I/ H2 b
  165.     @left_state = 0( U. B$ {4 ^# _/ K$ o( r
  166.     @right_state = 0
    % X$ N2 t8 l, E! G3 ]. D# E( G% ]" \
  167.     @ck_count = 0 # 帧数计,单击以后从0开始! x- A5 G8 h5 {8 r! L1 \/ H7 d
  168.     @dk_count = 0 # 用于双击的判定
    4 `" U0 E+ S" a/ p/ ^4 k$ a
  169.     @clicked = false+ O9 x3 ]+ [  v! R6 G8 E
  170.     creat_mouse_sprite$ x/ Y0 L# _6 l: s
  171.     update- Y. m, k/ }$ u
  172.   end( `% Y" h) Z  _
  173.   #--------------------------------------------------------------------------
    : w. |6 p" `7 S# \
  174.   # ● 鼠标指针精灵
    5 G( u8 e% E- q4 B9 E! z
  175.   #--------------------------------------------------------------------------
    , z5 [) P0 l4 R5 t. X/ i
  176. #~   def creat_mouse_sprite
    : D' a0 @5 q7 Y5 C. y1 X3 x" ^+ P
  177. #~     
    ( D% ~% G. z7 q# [' N) P: A2 M% [0 ^
  178. #~       @mouse_sprite = Sprite.new
    6 v: x3 K( m8 H( Z6 w- e" O
  179. #~       panda = 2#rand(2)+1
    3 B! k/ ]+ ^' x! g. t" A8 u9 Q

  180. 3 |( R' _4 V* r% w
  181. #~      if panda = 19 f4 J6 V8 s5 K+ X
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    3 }" ]- n; v1 W" d2 X
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')# f$ _( s% P+ }3 j, l7 b  R
  184. #~        end#with if File.exist
    + r5 d1 o  j' X0 g3 _
  185. #~    # ]4 M+ j) F% e5 V- N0 L$ v- M# `
  186. #~     else if panda = 2 #with if panda=1
    . @2 I$ w7 ]( ~  x* f* w
  187. #~      6 l5 l& D$ F3 u. }* M* ~* ~; K
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    / G: o5 w7 f) j' P( {; m/ {- D+ Y
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')! z) @; r1 t9 T
  190. #~      end#with if File.exist. P+ o7 l4 V; |# v
  191. #~      
    $ c- ~. p/ |) m6 M% {
  192. #~     else #with if panda=1
    & \2 @7 r( y. l- q1 V# x5 d! Z
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    & A; T2 ]+ E: h' I/ C$ y, n
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),! P) V1 j+ v0 `: p
  195. #~       Rect.new(5  24, 24  24, 24, 24))  e* n: p$ M' x; f3 ]: F) w1 M" i
  196. #~     end#with if panda=12 r' Q$ N) J0 X0 \' L" ~5 V+ v
  197. #~     3 {% D$ l9 b4 M- i* }
  198. #~     #with def
    1 Q( v+ Y$ W% K- b/ t. F, n8 R* u
  199. #~   end
    3 A9 B- u! v% k  C
  200. def creat_mouse_sprite2 a; d" O( m) H1 k- V: a
  201.     @mouse_sprite = Sprite.new
    9 K2 M- b; i) O3 j; f8 {
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})  P8 H1 e8 _- f5 Y' Q3 E
  203.     @mouse_sprite.z = 9999
    ' D# j; b: [+ B5 h
  204.     Show_Cursor.call(0): W; o, H/ C4 z1 ~
  205. end! }+ s. O4 t3 n$ k
  206. 9 F3 l+ Z1 r0 V* a; ]
  207.   #--------------------------------------------------------------------------6 {& b* q- M3 w1 u7 s% k5 {; k7 ~
  208.   # ● 更新
    ! l) c6 v& ?9 b* a
  209.   #--------------------------------------------------------------------------
    1 e7 W4 ~( Z7 [' r( n
  210.   def update
    $ \+ {; \7 {8 ~3 J. ^7 e  P( l$ P/ v/ V$ M. j
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    ! I. V0 l5 f' V& w
  212.     left_state  = Get_Key_State.call(0x01)
    / X, k8 _# d7 y7 i& X4 C0 b9 ]" [
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    1 G0 L8 K3 J% f6 i' J
  214.     right_state = Get_Key_State.call(0x02)$ k* o/ Y2 y+ Y. o" H
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    3 Y3 x- b2 s/ A0 P
  216.     update_double_click# `5 j& A: h# g  X
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    ! ^8 V& p  ?# g& N# k* ~! p
  218.   end
    ! m: f$ x- l, b
  219.   #--------------------------------------------------------------------------
    ! E6 z6 N9 U5 d5 m  G5 V
  220.   # ● 获取鼠标坐标
    ' s; h# y2 g% |. M3 F' O$ h
  221.   #--------------------------------------------------------------------------
    9 f  G8 N0 w4 W( C+ ~* [
  222.   def get_mouse_pos6 Z4 W( ]. m9 w8 z4 r8 [, [
  223.     arg = [0, 0].pack('ll')! q! f1 r8 m! r8 F( W- ]3 o
  224.     Get_Cursor_Pos.call(arg)
    ; y( y' Y( l  E& \
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    ) }# ~; ~( }4 P
  226.     x, y = arg.unpack('ll')5 i* d. k2 W; D
  227.     return x, y' Q% k4 I5 i7 a# Z/ K% _4 @
  228.   end
    4 b+ O: V9 k! e% C% w$ d
  229.   #--------------------------------------------------------------------------
    5 Q) w  k+ W* v; W7 _# s: `
  230.   # ● 将鼠标固定在屏幕内
    9 y9 ]2 q7 N3 _. R- q& l
  231.   #--------------------------------------------------------------------------  b1 H2 W% K; F- \( f# [5 |. X1 f
  232.   def lock_mouse_in_screen$ B7 }1 O) a; E: s& ]! `6 T# O9 l
  233.     arg = [0, 0].pack('ll')$ y0 E/ f  ]7 F/ |& u: u2 ^
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    , y8 N4 z3 A4 B
  235.     x, y  = arg.unpack('ll')
    ! D9 O# C7 g6 g9 E4 C7 ~' j- M
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))2 d! ?- s. {4 j" e4 t* Y) P1 P
  237.   end
    0 ^, N' h  u$ M7 s4 q" R
  238.   #--------------------------------------------------------------------------
    % x2 D" P5 e% v
  239.   # ● 解除鼠标固定
    8 z# n) u! C0 a# n3 b* \6 I# [
  240.   #--------------------------------------------------------------------------
    + W1 r$ J& {& a2 {+ r2 l
  241.   def unlock_mouse_in_screen
    . ]0 W5 t/ |5 `. ~2 d" R9 Z
  242.     Clip_Cursor.call(0)
    & N0 b  M" Z: \' L
  243.   end! E) U5 O( J: y
  244.   #--------------------------------------------------------------------------3 r) a' Q& }, e9 G' W' Z- p  @/ `
  245.   # ● 鼠标双击判定* a; a9 o, ^2 y5 c$ O$ F! X, [
  246.   #--------------------------------------------------------------------------8 T3 o* Y/ u3 a$ l* |6 I/ p& j
  247.   def update_double_click/ j! Q' x5 v/ }2 j' U1 ?
  248.     @clicked = true if @left_state == 1
    9 l$ G* `$ q6 r
  249.     if @dk_count  0 && @left_state == 1
    6 e" K" q5 G0 v# z
  250.       @dk_count = 0; @clicked = false* @! A7 Y& I! T# b6 W
  251.       return @double_click = true
    ; H4 X  K1 V- i. O4 f
  252.     elsif @clicked2 k2 F/ I+ o) z) r- ?3 _
  253.       if @dk_count  KsOfSionDbclick_Frame
    + N1 Z' f( \9 K
  254.         @dk_count += 1, J4 v, @* u4 i" {
  255.       else
    , w) V/ E# p# S: V* ]* z
  256.         @dk_count = 0; @clicked = false/ V4 n% `/ H: t4 d9 Q
  257.       end8 T( N/ [$ y% D5 W, @8 P
  258.     end5 w% \9 {  }( h+ |) Q3 [2 _
  259.     @double_click = false
    ; `* P; }* P3 y, T
  260.   end
    ' }8 |3 d' z: x
  261.   #--------------------------------------------------------------------------% ~. M8 ^+ @' i" P
  262.   # ● 按键被按下就返回true
    $ I* \4 I' E1 l: v. Q% \% E& V
  263.   #--------------------------------------------------------------------------% x* c% w8 B7 v* _6 }
  264.   def press(button)% M. r. _9 h/ T) J; W1 Z; t
  265.     case button
    ! i/ s1 c$ ^2 S9 w0 V6 k
  266.       when 0x01; return !@left_state.zero. x- A+ z: P/ L9 [% f
  267.       when 0x02; return !@right_state.zero1 X  b0 i1 T$ b  v
  268.     end
      H& J  Z) H( p; c- e
  269.     return false
    7 c4 L3 K" z1 S( J4 }
  270.   end
    1 q% A# c7 ]: I! V
  271.   #--------------------------------------------------------------------------* f% P3 I0 L7 j' G1 R! C
  272.   # ● 按键刚被按下则返回true! d( q) b5 R0 c* p. z5 Q! I
  273.   #--------------------------------------------------------------------------: s, k+ q% Q- d+ j- r5 a+ L7 d
  274.   def trigger(button)
    0 W& O# w6 r0 S5 [! ~$ D* A
  275.     case button
    & C; Q; S# P+ x( c6 R% e
  276.       when 0x01; return @left_state == 1- Q8 }$ b( U# L+ d
  277.       when 0x02; return @right_state == 1
    % l# z1 u, V/ e5 j3 h# \
  278.     end
    . E; ]0 |! f7 {
  279.     return false/ h0 w- v5 U2 X) u
  280.   end2 A0 A1 e! R  k
  281.   #--------------------------------------------------------------------------- w# Z4 \2 L+ y* U
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    - X: ^2 ~0 M' T( @; \& H( h7 p
  283.   #--------------------------------------------------------------------------
    4 }/ c6 P; I5 {0 H' l( p
  284.   def repeat(button)& V5 V5 W) m" t/ G. o/ }$ K
  285.     case button* C& J' J, R" C3 f
  286.       when 0x01; return @left_state == 1 " L& W4 F7 ?9 R- m% w6 K/ W5 X
  287.         (@left_state  22 && (@left_state % 6).zero)
    0 _( O- n0 N* r0 m! s& P: C
  288.       when 0x02; return @right_state == 1 2 u( t: c! r5 G
  289.         (@right_state  22 && (@right_state % 6).zero)# O/ R+ P( Z) t: {' `
  290.     end4 s1 Q, P4 {4 l6 D1 b% l
  291.     return false
    8 c- c+ t7 w4 A% z3 a$ r
  292.   end
      r6 V, E/ S/ L+ ~9 |8 k* U
  293.   #--------------------------------------------------------------------------- J9 d* o9 a# K+ F
  294.   # ● 判断是否双击鼠标3 J" }" ?4 B5 W# ~
  295.   #--------------------------------------------------------------------------8 j: ]1 x; B& Y8 k( x. Q  w( y- {8 [
  296.   def double_click
    & B/ U( x9 o4 K5 N' g
  297.     @double_click
    . k# c! c/ _* m# r
  298.   end* W, q! a" T( q$ w% G
  299.   #--------------------------------------------------------------------------
    2 T8 T" A8 I6 S5 v* Y2 `
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    0 i; I1 c9 W+ ?2 A( J% Z
  301.   #--------------------------------------------------------------------------
    7 S& j/ V# k) O
  302.   def click_count
    9 Z- M+ B4 f% W3 w  I
  303.     @ck_count
    , l, K9 h$ s& N, L+ s& i
  304.   end. t# O/ N& ?0 |% E
  305.   #--------------------------------------------------------------------------* C( x, `+ _$ r7 Y& A
  306.   # ● 获取@left_state(按住左键每一帧+=1)5 s) j6 `$ e$ O; v3 F
  307.   #--------------------------------------------------------------------------
    / g$ Z+ a1 w0 Y, L) e
  308.   def left_state% ~+ [* G: f$ l0 w& B7 V/ x
  309.     @left_state, @! ?& X  i) J0 @6 p( X! J1 j
  310.   end
    # h; J+ \+ o1 n1 {
  311.   #--------------------------------------------------------------------------
    # @+ g# n. u8 j9 q
  312.   # ● 获取鼠标的x坐标8 e9 C& Y, A% }  A
  313.   #--------------------------------------------------------------------------. M; E% ^9 n' H
  314.   def mouse_x
    ) K1 O1 v  n/ p: `( x/ g- Q9 S
  315.     @mouse_sprite.x
    - q6 a( j/ F% e) j9 O( d1 Y, e
  316.   end! |- q8 ?  M; V; ]& p- V
  317.   #--------------------------------------------------------------------------7 _  ?4 s/ I% a5 q
  318.   # ● 获取鼠标的y坐标
    $ B2 b- M4 V5 k% h) n$ f/ L# V
  319.   #--------------------------------------------------------------------------
    % ^. |, Z1 z& m% q' ]  p7 \
  320.   def mouse_y2 f9 ~0 m# l3 q$ K
  321.     @mouse_sprite.y
    : K7 B4 V' ^( Y9 ?% _9 f+ W
  322.   end, w5 n2 {' U8 e8 [
  323.   #--------------------------------------------------------------------------
    / O" R: Q% H: h6 b  Q$ u
  324.   # ● 设置鼠标坐标
    5 i) K5 Z$ j2 o& a& B
  325.   #--------------------------------------------------------------------------- R& a$ B" N6 b0 e3 V* R* L/ _
  326.   def set_mouse_pos(new_x, new_y). z: \- o" ~) m, A; y
  327.     arg = [0, 0].pack('ll')
    ; H3 z7 ~  }( L
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    6 q5 ~9 ~9 C0 }  }1 a8 X/ C( ?* x- b3 D
  329.     x, y  = arg.unpack('ll')
    4 |2 z7 g* `  A# _$ [8 g1 E
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    ( |, J! g  u- D
  331.   end1 J2 @. d6 c( g; ]$ m
  332. end #end of class  self
    2 [* N4 M& K9 A- ?) K
  333. ) `. x# ^3 }. s. e7 u  G
  334. end0 _  B& W( R+ ?2 F) v( F2 D. T

  335. $ D4 w, f4 P' n
  336. #==============================================================================6 k( j8 K0 D% h+ w- J% ]
  337. # ■ SceneManager
    * ^; C) Z6 x% A6 p! ?/ C0 l. W! e7 |
  338. #==============================================================================
    5 e$ v2 F) f" {7 O# K" ]
  339. class  SceneManager
    6 L" n* e) O* q0 j9 t
  340.   #--------------------------------------------------------------------------7 z+ ^. u+ h! i# q' g1 r
  341.   # ● alias
    ) {6 j( s/ d1 v1 p1 S" d
  342.   #--------------------------------------------------------------------------
    ! }& f3 j: |- u2 z- {
  343.   unless self.method_defined(sion_mouse_run)
    9 z- p+ j' P" @! Q4 x- I
  344.     alias_method sion_mouse_run, run
    - j9 a$ p( `0 b
  345.     alias_method sion_mouse_call, call$ s5 Z/ O" e+ t
  346.     alias_method sion_mouse_return, return
    , J- Q% C6 R7 e- z5 ^. I/ {6 K( w
  347.   end: _3 x/ Z; r* s
  348.   #--------------------------------------------------------------------------$ F+ L1 A/ ?5 a4 _
  349.   # ● 运行
    . C$ x2 Q4 W) G2 f/ i8 p
  350.   #--------------------------------------------------------------------------
    ! J* S2 T$ X0 q4 J1 S! b
  351.   def run
    $ g5 L& H+ i* E+ j: }, A
  352.     Mouse.init, o% Z9 i; @8 L1 u7 c- w
  353.     sion_mouse_run
    1 b, Z4 d  w) v: F! m0 j
  354.   end
    4 n" M4 X, Z, z8 P  S
  355.   #--------------------------------------------------------------------------
    & D# ^1 K; z) s$ f9 j3 d
  356.   # ● 切换1 `) n' T# k; ^( Q
  357.   #--------------------------------------------------------------------------
    : e: {) X1 i# [3 W+ b( W2 F7 }
  358.   def call(scene_class)
    / h% s' Y9 P- ~8 {; U
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)# L6 {# T; ~+ n6 y- T/ x
  360.     sion_mouse_call(scene_class)  I9 n4 G* [( g% y  V
  361.   end
    5 w# L6 B, N6 |: x1 `6 F
  362.   #--------------------------------------------------------------------------
    7 m/ u) ]1 c1 A# z4 Z3 E# }
  363.   # ● 返回到上一个场景
    $ H# u6 t, X" {  m
  364.   #--------------------------------------------------------------------------0 g' p# J: k, F$ {7 M4 b4 v/ M
  365.   def return. B- r9 l; ^! H* w, k' x
  366.     sion_mouse_return; Z& |5 G1 M6 a& z
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    3 a" {+ a& _) d# e
  368.       @scene.instance_of(Scene_Map)
      W/ r4 m; e* \' A" [' y% m8 d
  369.   end
    8 J. ~" T- ^3 ?$ \# D7 h+ U# V
  370. end
    ! O$ x5 {- _/ F7 R6 ~% O
  371. ; T, ?& {& P# A( l$ v
  372. #==============================================================================
    , M: j3 e3 K; O0 s1 D) o9 V; [
  373. # ■ Module Input
    0 y/ @/ k5 @: }. B9 k6 n: l
  374. #==============================================================================
    ) U2 W3 c( ?8 Y2 U7 w* m
  375. class  Input
    5 I6 ?$ a3 l2 @+ P4 \6 ^- E
  376.   #--------------------------------------------------------------------------
    ( W" J3 H5 |  k
  377.   # ● alias
    & C. H! L$ U" C. f
  378.   #--------------------------------------------------------------------------/ I8 `( L% ]. [/ W
  379.   unless self.method_defined(sion_mouse_update)
    ( N3 `2 w4 J9 v2 s" U
  380.     alias_method sion_mouse_update,   update
    % D5 L& V5 l$ Q
  381.     alias_method sion_mouse_press,   press
    9 S( `2 O0 `/ ~% ?1 \% }: `
  382.     alias_method sion_mouse_trigger, trigger2 s. E+ t7 ^) u0 u( C! P* W
  383.     alias_method sion_mouse_repeat,  repeat8 w- _" v3 @0 h9 z
  384.   end
    " I' G( Z& {" ^7 `! W1 q' M. f1 T
  385.   #--------------------------------------------------------------------------* M$ \; @. {# [" i8 L6 c4 q
  386.   # ● 更新鼠标
    & t2 n& Q# X  a4 O& s. v: s
  387.   #--------------------------------------------------------------------------
    " l" J- N+ r9 p7 s2 [! H! ^* K
  388.   def update- ]; l7 {; g( ?/ u1 F& f
  389.     Mouse.update
    : K5 c+ s8 D: ^* B$ q
  390.     sion_mouse_update! I! T$ {( X, A' @
  391.   end# n2 ?- X0 g1 ?( Y( \
  392.   #--------------------------------------------------------------------------
    3 }' Y4 s3 {2 W, G" t
  393.   # ● 按键被按下就返回true
    : f0 g" X. O3 P6 b$ y% c
  394.   #--------------------------------------------------------------------------
      k+ B0 v' p! ]1 k+ o
  395.   def press(key). X' _6 w/ u# S( L
  396.     return true if sion_mouse_press(key)
    : ?8 a( F' X- {5 C  ]' l9 Q
  397.     return Mouse.press(0x01) if key == C
    3 Z8 x2 Z$ l; }0 i0 o" w4 j+ o
  398.     return Mouse.press(0x02) if key == B
    7 p; F7 ~% V4 o7 `6 o
  399.     return false
    " k- U, ?* Q  }/ }6 l
  400.   end
    6 u- c; m: M! d0 l- m; |
  401.   #--------------------------------------------------------------------------$ ?% ~: A4 d: i
  402.   # ● 按键刚被按下则返回true
    * Y9 z+ V/ l: l9 \
  403.   #--------------------------------------------------------------------------
    7 {2 R+ C' q% d; l9 u3 q
  404.   def trigger(key)
    & X* M0 T4 X9 W4 x2 A4 S
  405.     return true if sion_mouse_trigger(key)
    ' h  g" E. X0 S6 V5 a# b7 Q
  406.     return Mouse.trigger(0x01) if key == C, y. ^, a. ]$ h
  407.     return Mouse.trigger(0x02) if key == B% o; y  [7 ?1 t
  408.     return false
    + W' t7 U, ]; s7 x1 W8 q
  409.   end5 w7 b3 z, b6 c( X' U# Q
  410.   #--------------------------------------------------------------------------' P6 n' P( P+ c3 P" ~
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true$ l! i; Q  k. M
  412.   #--------------------------------------------------------------------------
    3 j& M# _# J5 s& x- H
  413.   def repeat(key)
    2 O+ n* `( l$ P
  414.     return true if sion_mouse_repeat(key)
    8 a! A/ f% A/ ?) I2 o5 E( J" \
  415.     return Mouse.repeat(0x01) if key == C
    ! T  G, N' \: w* M9 n* y: J: w
  416.     return Mouse.repeat(0x02) if key == B
    , }6 d- i6 F6 c, C
  417.     return false( M1 H  E0 _9 ^3 e
  418.   end! k/ r# s  \& U, E
  419. end. L" e3 _, ~  r5 r! E
  420. 5 N, J7 S6 r, y6 G0 M( J8 c; f  L# f

  421. - J1 c/ [  I. v) s: T0 I8 J
  422. #==============================================================================3 J. a& W3 Q. ^% i
  423. # ■ Window_Selectable
    ( b/ g/ A  F( D$ A
  424. #------------------------------------------------------------------------------/ }2 r  W# W. g  K
  425. #  拥有光标移动、滚动功能的窗口
    # b+ Z2 i$ c1 V  e
  426. #==============================================================================
    2 t2 t' R: g2 v0 j
  427. class Window_Selectable& ^, G+ S% k! d" X* o/ v
  428.   #--------------------------------------------------------------------------
    : X1 L0 \8 d( }; M; E- e9 J% t
  429.   # ● 初始化
    0 h* n& r: g3 [$ _
  430.   #--------------------------------------------------------------------------
    1 {( W- w: n4 Y' L: m
  431.   alias sion_mouse_initialize initialize
      o& F8 @" \* v
  432.   def initialize(x, y, width, height)
    ) p4 r, j' T$ D' g0 `) z! e
  433.     sion_mouse_initialize(x, y, width, height)! T$ ?& g1 f% u  v+ n
  434.     @move_state = 07 I8 x. k  C' j' p: A. E6 X
  435.   end
    5 C% [9 T3 ~) V" K- n
  436.   #--------------------------------------------------------------------------( G5 T( P0 `. k; t0 [. e
  437.   # ● 更新2 i. l* P% d7 y0 z3 T6 q; i
  438.   #--------------------------------------------------------------------------
    4 n2 E8 x0 L. @7 H0 _4 C
  439.   alias sion_mouse_update update
    % m% u6 Z* e0 q
  440.   def update
    . C8 V: A: P: P; V# ?
  441.     sion_mouse_update
    * I: `# V+ x: m* F7 V
  442.     update_mouse_cursor; W7 T* o0 R" }
  443.   end
    : }) [$ e6 ~; B
  444.   #--------------------------------------------------------------------------# }" F+ A& h, N3 h) Y- q8 h8 E' G
  445.   # ● 启动后设置鼠标到index位置/ D# X- w) e0 W' X5 o( H) ^6 o& T
  446.   #--------------------------------------------------------------------------
    " k+ `" [, U& k7 Z- d
  447.   def activate
    ! s7 A3 K/ o. }) `: F
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos# ]6 G  f: E8 X2 I* }
  449.     super) F. I/ u6 d2 H! L: k" f7 U" `; f
  450.   end
    ! W7 L1 V4 M# w4 G8 i6 }
  451.   #--------------------------------------------------------------------------
    * S: U, ?0 H! {; M
  452.   # ● 更新鼠标和光标的位置- k. o% P1 N5 N
  453.   #--------------------------------------------------------------------------
    % w* K$ W* B# W6 R* X
  454.   def update_mouse_cursor
    ( Q& k' ^- [4 \
  455.     if active9 F  @- G8 [; ^) t
  456.       if @need_set_pos
    3 ?" U5 |! ~5 M6 T( e" f/ {
  457.         @need_set_pos = nil' _& V2 P, N2 A! q4 ~& q7 q
  458.         set_mouse_pos
    9 [& F2 d/ [, |; U
  459.       elsif cursor_movable
    3 Y$ Q6 T$ Z+ V. A' U
  460.         Input.dir4.zero  set_cursor  set_mouse_pos5 m1 G; T0 K6 m* ]
  461.       end
    3 L8 N  f2 k9 d3 R2 u% G, |; E* u! {
  462.     end
    & J2 y6 A) A, B
  463.   end
    1 M3 b) O8 x( E
  464.   #--------------------------------------------------------------------------
    + [! |" I% A+ R
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    $ ]) u9 h% n+ W# x- j
  466.   #--------------------------------------------------------------------------. O1 S) E8 M$ u$ `. q
  467.   def set_cursor
    $ {: b, ?( x4 b, s  i5 f+ s5 k
  468.     mouse_row, mouse_col = mouse_window_area
    ' n; y9 e5 G8 m8 c* d* A
  469.     if    mouse_row == -1
    - \- V- b0 ?9 z* g1 u5 F/ O1 |* U6 }
  470.       @move_state += 1 if need_scroll
    7 f  u& u! ], R/ S. a6 F
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    $ O9 P; e- F3 N+ @# C3 J
  472.     elsif mouse_row == -21 ]$ s$ L( F% g. n3 C
  473.       @move_state += 1 if need_scroll+ [7 q1 \# j/ D, x& i( q- ]3 C2 Q# q
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand, I+ N. p5 T! J8 X4 u$ G% X7 g! ?; u
  475.     elsif mouse_col == -1
    ! Z5 @* {5 k* j- ^' k
  476.       @move_state += 1 if need_scroll) y& k" x9 i  j% L" {
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    % k) ^! z! i2 l
  478.     elsif mouse_col == -2
    : q0 r3 U- \# i5 m) L
  479.       @move_state += 1 if need_scroll1 c9 \$ Q, j$ c; p9 ^' }
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand: T2 _  J3 Y. j: ~. H( c' {" F  h2 U7 ]
  481.     else
    ! x) X' Y  M) {! Y- x! Y
  482.       @move_state = 0; h+ G9 ~  k( ]6 `/ U* w
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    ! D1 s* ]: C# e& R0 n
  484.       select(new_index) if new_index  item_max && new_index != @index/ Z( e8 Z: h/ E' A6 d* C
  485.     end' i, X9 y/ `6 l% }8 g# M
  486.   end. ?$ e3 f) a: I( g  S! z
  487.   #--------------------------------------------------------------------------
    7 E( o! J& B5 {* L/ I
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    : r* [7 I. k3 x: j! Y( a0 t
  489.   #--------------------------------------------------------------------------! X* @2 M6 f4 U+ ?- f0 `0 n
  490.   def mouse_window_area
    # x2 m' S3 D" |; h" _2 ^
  491.     if viewport.nil # necessary!" w# m" M' j4 @
  492.       vp_x, vp_y = 0, 0- ^: J' B" c. x8 F: p, {
  493.     else& K4 U' A- t- u# t# }
  494.       vp_x = viewport.rect.x - viewport.ox( B# h2 C+ F: n9 c1 J
  495.       vp_y = viewport.rect.y - viewport.oy
    2 W; r9 ?  K5 e
  496.     end; D. L( @4 n8 G! N) X9 S
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    5 E+ B- x( R5 d3 j9 o
  498.     item_x1 = vp_x + x + standard_padding ! |1 w& r5 B7 c, Y2 j- U9 l9 O
  499.     item_y1 = vp_y + y + standard_padding
    # K  @, H7 P+ `
  500.     item_x2 = vp_x + x - standard_padding + width
    0 @, s0 v2 o- i3 e4 R6 f* h& S
  501.     item_y2 = vp_y + y - standard_padding + height
    , B+ y8 c0 k3 @/ k: h/ @
  502.     if mouse_x  item_x1
    ) @5 X6 C7 g0 u8 |% X) H6 _* i
  503.       mouse_col = -18 E2 |, v  S4 l# f* n% H
  504.     elsif mouse_x  item_x2% u9 W+ i3 V) q; u
  505.       mouse_col = -2/ Q+ M# j  ~* R# s2 t: S0 W
  506.     else: ?3 z' G; Z7 X; t0 A. w8 S. Q
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)5 k% W5 A) p$ a$ y7 W- x
  508.     end/ R0 }" ?4 M; q
  509.     if mouse_y  item_y10 B6 _7 P0 a  Q9 B, C0 O
  510.       mouse_row = -1# e' y- [: H+ N
  511.     elsif mouse_y  item_y2% \! N4 t& L6 T- t5 o
  512.       mouse_row = -2
    : w. u! c5 O# v$ M
  513.     else  d8 F6 g% y: i1 p1 m) t  `- L
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)" Y" h* ?* Z9 \9 r3 t& Y% q
  515.     end
    ; H, V. D; r1 \0 v, j& Y6 ]) ^6 @8 a
  516.     return mouse_row, mouse_col
    , c: O6 L: \; o" o, w  B# Y- r  J
  517.   end$ ~4 o$ A, c0 e; u
  518.   #--------------------------------------------------------------------------% ]7 v! S  {- b7 }0 J7 g4 O
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    % b- r: m/ y& X+ A) G1 z
  520.   #--------------------------------------------------------------------------
    * `( ~/ A  a+ T8 W
  521.   def set_mouse_pos! M" e# Y8 `. M8 A7 p; z% ?
  522.     if viewport.nil # necessary!+ D) q/ T+ L4 _; s/ i8 {; ~1 ]- _
  523.       vp_x, vp_y = 0, 0
    # I& L! P. \. j5 K: x
  524.     else' D+ L+ e) U8 E1 \
  525.       vp_x = viewport.rect.x - viewport.ox
    6 l3 C. M8 j5 N
  526.       vp_y = viewport.rect.y - viewport.oy
    ) O0 p3 D3 k/ U: E7 e# n1 J  V
  527.     end2 V$ s5 u- F! q4 d4 _: O
  528.     item_x1 = vp_x + x + standard_padding
    5 z4 ]2 r/ b! Y( [
  529.     item_y1 = vp_y + y + standard_padding
    3 R; }% E. ^4 b& Y6 I2 p& D
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index 0 i/ b" u9 U1 W4 Q+ O* V; O) {
  531.     row = get_index  col_max - top_row
    0 e/ Y2 v/ l: k: ]8 G7 g
  532.     col = get_index % col_max
    $ Q% _2 ^& H/ Z5 z2 R
  533.     new_x = item_x1 + item_width  (col + 0.5). {1 H4 x! b4 s. M, ^5 |4 a) J
  534.     new_y = item_y1 + item_height  (row + 0.5); S2 w; r% J( b1 R( S
  535.     Mouse.set_mouse_pos(new_x, new_y)+ z# \# g$ T5 e4 O' S+ l
  536.   end
    2 t0 p4 r- b  L: z8 }
  537.   #--------------------------------------------------------------------------
    ( G. O0 g  U) e* z, K% j
  538.   # ● 判断菜单是否需要卷动
    4 q( g: H3 D5 M  o
  539.   #--------------------------------------------------------------------------
    + R& _7 {" ~2 E6 S* U: l: W
  540.   def need_scroll$ V9 E. y- \* k% Z% h& @* D. g
  541.     item_max  col_max  page_row_max( @1 ~+ r% T7 P% ~# n' ^8 o& P
  542.   end
    ! A& H& l9 F7 K% a1 f. ~3 K5 c
  543.   #--------------------------------------------------------------------------
    7 A, n* g  i( G9 ~2 {
  544.   # ● 判断是否为水平卷动菜单. A2 v: H- i0 h7 k1 L: T
  545.   #--------------------------------------------------------------------------. \3 B' P' c/ b* c. _% O
  546.   def is_horzcommand
    4 `- `- a- d; x
  547.     return false
    & H5 d+ I0 \( D1 v" A$ K
  548.   end
    * A5 G$ }+ p- e" {- h" y% A
  549. end
    1 H, q6 v4 Y6 J0 T. P
  550. % e/ M& F- r; ]# O6 n
  551. class Window_HorzCommand
    3 v8 D$ r# m( D. e1 t+ f" e
  552.   #--------------------------------------------------------------------------
    4 ]6 i4 r0 B! U7 v8 A, ?
  553.   # ● 判断是否为水平卷动菜单
    - V# c$ _7 r( v+ j; Q8 E( q
  554.   #--------------------------------------------------------------------------
    2 m) Y: q8 `: Y% j6 {
  555.   def is_horzcommand
    % A! V4 }( x# @, B; S6 Q
  556.     return true
    ; S. |8 s5 z& `& U( a" @0 b/ j
  557.   end  c0 }, W% C' z+ f
  558. end* s& y) ^8 g! ]# S0 k

  559. ) s( v% s0 p( A$ _" T' g3 V: x
  560. #==============================================================================
    , B0 b- @* M+ |/ \$ b0 z) o5 h
  561. # ■ Window_NameInput
    * @/ d' A; C& t0 E6 W; s  w; c
  562. #------------------------------------------------------------------------------: W6 g( P, q1 v5 t4 G5 X
  563. #  名字输入画面中,选择文字的窗口。8 A( |' o; L- y
  564. #==============================================================================3 F+ `9 f) i) r7 O) \$ r2 ?
  565. class Window_NameInput$ F* Y* L' j2 ^% r) f
  566.   #--------------------------------------------------------------------------
    3 ^% j; i* A' E7 O$ W9 i
  567.   # ● 设置列数, L" ]) f% U8 ^9 w
  568.   #--------------------------------------------------------------------------
    9 e1 C( ]1 P" a6 _9 L- E7 e+ R+ @7 F
  569.   def col_max! N( c% J& |, O( D9 \  D
  570.     return 10: Q3 T. U/ i- z, \$ i4 C0 g
  571.   end
    9 K/ |  u9 w5 }8 T0 e2 x
  572.   #--------------------------------------------------------------------------
    / X; W1 y# R. k9 U: [
  573.   # ● 设置填充的Item个数
    % g, Y3 O1 f- {+ D6 T* p5 t2 ?8 O
  574.   #--------------------------------------------------------------------------
    3 X: [, x7 B$ y1 _9 z
  575.   def item_max, W$ A9 \. {1 ^
  576.     return 90
    8 s9 M! S/ o$ c1 ^
  577.   end( b. o# O5 W6 m9 Q4 h+ z
  578.   #--------------------------------------------------------------------------1 Z- u' |+ E2 W# g+ r1 s. x# R
  579.   # ● 设置填充的Item个数
    ! h$ R' z3 O7 ~: ?3 t4 u
  580.   #--------------------------------------------------------------------------4 K! y" b: z7 I8 k# q/ P1 Y* ~" R$ G
  581.   def item_width5 n4 p! M' N! f) J0 o7 i# s
  582.     return 32* d6 B- q& g( `- z
  583.   end8 \! c) Q" Q6 E/ D4 m
  584.   #--------------------------------------------------------------------------
    ! M+ r, s7 E* N2 l
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    ) _( w3 r/ L! [& l+ w+ a' |
  586.   #--------------------------------------------------------------------------
    ; w2 Z( M1 I4 X6 y8 W4 s" d
  587.   def mouse_window_area
    + f3 q: q8 X  [9 I" `! C( L* T
  588.     if viewport.nil( s' P; Y! Y3 @8 o2 v
  589.       vp_x, vp_y = 0, 0; ~1 ]5 x6 p' E# z
  590.     else
    ( `+ l( S) p, W* T' L; r+ `( m$ F  i
  591.       vp_x = viewport.rect.x - viewport.ox
    9 F# N) t; h6 k  A+ r
  592.       vp_y = viewport.rect.y - viewport.oy
    & A8 V$ }- O% d& R/ Y: K
  593.     end7 V* j9 m# s- r$ y4 f& A
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y: O3 f, X% p4 M
  595.     item_x1 = vp_x + x + standard_padding
    # N; y; P" H; n' `, ]
  596.     item_y1 = vp_y + y + standard_padding
      Y* a3 y9 E, n/ z  R  r
  597.     item_x2 = vp_x + x - standard_padding + width
    + x9 _& ]; M" _& v) R
  598.     item_y2 = vp_y + y - standard_padding + height, c4 j0 Y- R" _# @" i" w5 u
  599.     if mouse_x  item_x10 I( c! O* J5 }0 f
  600.       mouse_col = -1" {. n; X( N) w4 q' N1 M3 O8 O
  601.     elsif mouse_x  item_x2
    7 Q- o" t  H* K0 r6 }
  602.       mouse_col = -2$ e$ `+ X: }- _. u) S& b
  603.     elsif mouse_x  item_x1 + 1600 v) p) X# Y+ I0 W: W# E2 r
  604.       mouse_col = (mouse_x - item_x1)323 A$ C) a) X/ `/ v) _
  605.     elsif mouse_x  item_x2 - 160
    , k  Z3 `! O# R+ I" r
  606.       mouse_col = 9 - (item_x2 - mouse_x)32) i5 N5 [# ^; X( C. p# d2 C
  607.     else
    ! _0 r3 i: L; G( I$ D; s' o5 ?
  608.       mouse_col = mouse_x  x + width2  5  4
    ( D  _+ L* h$ z8 z! l
  609.     end
    # @  ]0 c8 V# |+ e
  610.     if mouse_y  item_y1
      |  o9 v, z: z  [
  611.       mouse_row = -11 r' ^6 N3 p  ]- m& w; B5 k
  612.     elsif mouse_y  item_y2. t- I. Q$ O# }" e! q' ?
  613.       mouse_row = -2; R3 Y* j" B( F; V: z' I0 I! W' z
  614.     else) @" \& D: F7 y, ?5 F3 w
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    : m. i/ v$ M1 N' ^; \
  616.     end& Q, T' M9 P) l% c7 m# ^
  617.     return mouse_row, mouse_col
    6 {$ T+ P  U  Z6 z( r3 W/ {% S9 }# Z
  618.   end) u* C# Y. [  i2 I: F
  619.   #--------------------------------------------------------------------------5 H& T5 m+ R9 K9 _0 z' g7 u; ~4 l
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ r" I3 _& h# t$ W! x- l
  621.   #--------------------------------------------------------------------------
    ) Q2 c& t7 d( |0 d
  622.   def set_mouse_pos
    . }8 ?- V* p' H$ v& n# T0 }; C0 m
  623.     if viewport.nil # necessary!
    % H$ P7 X7 S) L- f: L3 E' C" L) `
  624.       vp_x, vp_y = 0, 0, Z9 l" g+ w( ]# Z1 Q
  625.     else1 B. O* J# C1 Z$ Z
  626.       vp_x = viewport.rect.x - viewport.ox
    2 x2 I/ b1 [# e( ]- F
  627.       vp_y = viewport.rect.y - viewport.oy! i* x! [5 |( [; S! h
  628.     end, ?, A+ I! ]+ w* u; L# W( h
  629.     item_x1 = vp_x + x + standard_padding % R8 v+ Q- ~9 T& |% d# |
  630.     item_y1 = vp_y + y + standard_padding  {# f# x7 A9 N
  631.     get_index = @index  0  0  @index - [5 L- T6 q* j; I) u
  632.     row = get_index  col_max - top_row1 Z' `  w* ~/ L+ [3 p- Y8 c
  633.     col = get_index % col_max1 F% j. U6 x2 V# c1 _1 `
  634.     new_x = item_x1 + item_width  (col + 0.5)
    8 R3 t8 Y3 u( P# E) \- p% p8 B
  635.     new_y = item_y1 + item_height  (row + 0.5)
    1 f; o3 l$ w, c- X3 w' n% L
  636.     new_x += 14 if col  45 H: ^% u1 Q% Y+ Z; l/ @
  637.     Mouse.set_mouse_pos(new_x, new_y): K: K/ _  Q% S' l2 R; F
  638.   end
    , O; l& L0 f% N9 h- C' @5 Z
  639. end7 i. l) o' {/ _3 }
  640. ( l% q- t/ q2 u. O! L. o; i
  641. #==============================================================================
    $ L; S! H8 c! W$ Z3 Y/ f
  642. # ■ Window_NumberInput9 B6 e# @. k3 g# d9 X5 U  c
  643. #------------------------------------------------------------------------------' R/ {3 K. n( T* J' A2 E
  644. #  重写了数值输入的方法以适应鼠标$ P3 \! S) j  T
  645. #==============================================================================
    7 r' F1 {2 `! `) `+ R
  646. class Window_NumberInput  Window_Base% c# }  o* T0 ], s; k% \. |
  647.   #--------------------------------------------------------------------------
    5 E+ ?8 s1 v7 X
  648.   # ● 定义实例变量
    : g4 F' [* W$ r% v6 k% y3 E
  649.   #--------------------------------------------------------------------------# j9 {7 w0 s: D4 C4 K( l
  650.   attr_reader extra_window
    ) y5 q2 c4 c" ~: B
  651.   #--------------------------------------------------------------------------
    $ I  U0 H( \2 O
  652.   # ● 初始化
    , g4 _  Y# x: C
  653.   #--------------------------------------------------------------------------
    $ M, [8 g0 U; P9 |3 _  E2 f, j
  654.   alias sion_mouse_initialize initialize
    ! i5 H) q  ~4 o: d
  655.   def initialize(arg)0 `8 U( P& I7 N9 x  a
  656.     sion_mouse_initialize(arg)
    ' N( Q+ U- _% h; }# j
  657.     create_extra_window0 K, h3 I  m5 y  j0 Y! u4 k
  658.   end- J' N% W3 K+ ]8 O9 Z; ]
  659.   #--------------------------------------------------------------------------
    2 m9 |% |4 e& N& ~7 h8 {5 s# j
  660.   # ● 启动
    9 l) D# }5 H* o9 }
  661.   #--------------------------------------------------------------------------
    ( ^* C- E1 f4 y, |$ `0 ]( D
  662.   alias sion_mouse_start start' L- V8 K, r* ~) w$ x  U
  663.   def start
    * X# _' b; s& z) F
  664.     sion_mouse_start
    ) e  r( u: T  j6 t9 g9 F! y0 k
  665.     deactivate) L# E* H/ s% }, N; @
  666.     extra_start
    . _6 R4 S. q8 T0 w7 m% C8 \
  667.   end& I' z! Y, Y  x% Q& N) C* |8 S* `
  668.   #--------------------------------------------------------------------------- |2 U1 N2 X: J" f
  669.   # ● 创建新的数值输入窗口; a4 O, ?* i4 s
  670.   #--------------------------------------------------------------------------
    4 F& {  J3 |* o
  671.   def create_extra_window
    & l7 y! w. Y9 W6 `, y1 k
  672.     @extra_window = Window_NumberInput_Ex.new7 \/ r# c/ n$ \& c0 m1 \
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  24 \; R$ s! T! B4 \  o+ B
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }# Y' b: h8 l4 |" k8 V- a
  675.     @extra_window.index_proc   = Proc.new {n @index = n }4 c9 L' ?% x" B3 b8 s
  676.     @extra_window.close_proc   = Proc.new { close }% b% M" A: e  t* }
  677.     @extra_window.refresh_proc = Proc.new { refresh }5 |& Y. j  X* M
  678.   end/ j. }( }3 G3 W) ]+ o. O
  679.   #--------------------------------------------------------------------------: k1 z5 K9 x9 q% v: l
  680.   # ● 激活新窗口
      ~; l; s! |5 O' T
  681.   #--------------------------------------------------------------------------+ c7 ]# t% J) P. @- d
  682.   def extra_start5 L5 \/ s  Y  S7 D" K4 c$ ~
  683.     case $game_message.position
    ( M1 H/ w- L) q
  684.       when 0; @extra_window.y = y + height + 4
    6 o& |5 r  s0 |& x! v0 r/ p/ Y
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    8 ?' h- a6 R# K' g) K  Z
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    ; f0 k1 V' s9 g0 h. i+ k
  687.       else  ; @extra_window.y = 8
    & G1 _4 @* r% N6 a
  688.     end
    ; J3 E& o% k/ S' z1 z/ r
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    . p8 b/ e* }# t) k
  690.     @extra_window.digits_max  = @digits_max
    ( n! @  V# r& R3 A
  691.     @extra_window.number      = @number
    - D3 G" w* p. s% X1 N$ M2 ]( a4 N
  692.     @extra_window.open0 K5 `3 D( x- M+ [
  693.     @extra_window.activate4 e. S' @4 I$ F' B! Y
  694.   end4 a( h* E7 l" w: ~
  695.   #--------------------------------------------------------------------------! b* a) b  ?: \  F
  696.   # ● 更新& i' ?) C$ w4 @. o3 j$ }
  697.   #--------------------------------------------------------------------------
    ) H3 R: G5 [; K5 S7 h' P
  698.   def update
    ( f, J; P' H) D/ W8 F5 ]
  699.     super
    ' e2 S4 g- N: V5 O8 Y  ]* w
  700.     @extra_window.update
    6 I+ [( S# ?' g
  701.     update_cursor, k  N+ b' P. y; p5 G3 ^
  702.   end1 y3 J+ |  I, Y9 J" \; f! U
  703.   #--------------------------------------------------------------------------
    % m2 a. x% ?+ w. @9 k7 l, k
  704.   # ● 关闭窗口
    9 z! `& b3 ]/ h2 a, G& E
  705.   #--------------------------------------------------------------------------
    1 z/ W- o9 }' W4 E8 O
  706.   def close
    ! B4 A; I+ h5 B3 V; H" Z7 c( R- ^
  707.     super
    $ y5 ~! d* A# @5 [3 Z& v
  708.     @extra_window.close+ ?" j5 E2 `3 N
  709.     @extra_window.deactivate
    . _. a; M/ u5 P: m# b9 \  z
  710.   end
    0 b7 ^4 j  F# J; i& h, h0 F" e
  711. end
    ; k1 r: Y# x* U, n

  712. 2 y( R7 e2 f" N6 m
  713. #==============================================================================
    ! {$ t, A" @* m/ H0 `8 Y2 E
  714. # ■ Window_NumberInput_Ex
    3 g" j1 i' G0 P  H
  715. #------------------------------------------------------------------------------  t2 t5 ?3 r, |8 v" a
  716. #  新的数值输入窗口(NewClass)& c& Q' ]7 U" e' }6 }4 ~# S1 M/ W
  717. #==============================================================================
      C' ?& d& p8 C* w1 P5 l
  718. class Window_NumberInput_Ex  Window_Selectable  X3 j) U2 x/ K: K: h# @- O2 f
  719.   #--------------------------------------------------------------------------
    % \# S7 `* m% g
  720.   # ● 定义实例变量: a* a2 y' f6 T$ [5 }
  721.   #--------------------------------------------------------------------------
    3 p5 T! }# l! M* x) j( ~6 G$ g- m4 l
  722.   attr_accessor number_proc
    , J' x5 r, Y9 _( D
  723.   attr_accessor index_proc
    : m) H) |4 o' L  k. ?: y
  724.   attr_accessor close_proc; T" y( b/ V2 S8 Z$ h1 N3 D
  725.   attr_accessor refresh_proc$ L. y* M- Q7 s/ }
  726.   attr_accessor number
    ! X4 O( I. n/ i9 C: w
  727.   attr_accessor digits_max
    3 d8 E5 f% E" u& g5 Q2 l' ~2 W/ k
  728.   attr_accessor variable_id
    4 j& ~+ [+ B0 A  ]5 r1 C* n+ a) Z
  729.   #--------------------------------------------------------------------------
    ; J  f: A% T- P( {' E+ z
  730.   # ● 数字表# y+ A- X. \3 R( a! s( f, J) ~
  731.   #--------------------------------------------------------------------------/ ]+ B' G: N- d* d6 `8 ^% I6 O5 e
  732.   TABLE = [  7,  8,  9,  a4 X8 ~4 k! P7 e6 F$ v& }2 f( d
  733.              4,  5,  6,9 `& J1 j2 [7 z! V1 g' O, `
  734.              1,  2,  3,
    9 t8 C$ l8 F& J1 v9 w
  735.             '←',0,'确定',]
    * y5 |2 @% y# h3 T
  736.   #--------------------------------------------------------------------------
    3 t( N7 B' a! D8 F
  737.   # ● 初始化对象  y+ z; ]5 I+ F2 A7 ?
  738.   #--------------------------------------------------------------------------
    . A& k* S! a! ?/ ~
  739.   def initialize: u. b6 Z; V: A/ g( W  ^  i" T6 I
  740.     super(0, 0, 120, fitting_height(4))
    4 Z' r# l! W) }" ^% V: W
  741.     self.openness = 0; [# _- a' |; H, \6 L  @
  742.     @index = 0: m- v. t* O, z& Y6 p' G0 B2 C& M& w5 U
  743.     @number = 0( q) x' K5 d5 s0 ^; Z
  744.     @old_window_index = 0
    4 f! H! M; g. W
  745.     @digits_max = 0& z+ M1 \- G3 A
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    - [% d' O/ A, T: Z
  747.   end
      w4 L1 p  G7 G. [2 a: ?0 o) Q
  748.   #--------------------------------------------------------------------------
    ! K8 }7 K; w& K  [/ l% O
  749.   # ● 获取项目的绘制矩形2 W* A8 \$ J+ u) H; [- j) w/ C1 N% F5 F
  750.   #--------------------------------------------------------------------------% a3 G8 B$ W) L- W  W$ j# h
  751.   def item_rect(index)" ]8 h) N( ^/ P9 G
  752.     rect = Rect.new7 s8 n2 g1 T( F0 g. I  x6 {
  753.     rect.x = index % 3  32
    ) _/ e3 R; G1 I1 K/ p4 F" ^  q
  754.     rect.y = index  3  line_height
    . S+ D7 B& d; y% F( d. _
  755.     rect.width = 32
    ( D5 t& q4 a6 I/ M4 l
  756.     rect.height = line_height
    5 f" A! D+ F6 R7 C. s1 o
  757.     return rect
    4 k% T# M1 p7 c# ?
  758.   end
    % u2 |5 ^' P# ?3 k
  759.   #--------------------------------------------------------------------------7 M7 n& p* v  `
  760.   # ● 将光标设置到鼠标所在的位置
    * H6 R& U( V9 J. T9 H  E& V/ C
  761.   #--------------------------------------------------------------------------
    1 z. f# ?3 A6 {% l8 Z2 J% f  P
  762.   def set_cursor, _# x5 w+ W  }4 E& N) ?4 z
  763.     mouse_row, mouse_col = mouse_window_area* i( _/ A' U3 `) ?- D/ L5 l
  764.     if mouse_row = 0 && mouse_col = 0' W: ?* K8 x9 i+ @) _8 y# S3 b
  765.       new_index = mouse_row  3 + mouse_col
    ) R* ~9 C; d( _
  766.       select(new_index) if new_index = 11
    + K/ O; ^4 A' g# o/ |* P3 g7 w1 P
  767.     end5 \3 S4 d$ c6 ^, J
  768.   end6 _; y2 B! p3 E- U0 F
  769.   #--------------------------------------------------------------------------% Z3 V" M- |+ d0 c& C
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列  l- |8 v, O' `6 W0 S) p
  771.   #--------------------------------------------------------------------------' Y( c2 h) f$ q  v; [$ O% O  B6 W
  772.   def mouse_window_area2 x9 |) g7 Y' S- s: p, Z
  773.     if viewport.nil
    8 `2 q3 b8 S) W$ }0 d0 z
  774.       vp_x, vp_y = 0, 0
    , x; q: p. W5 M6 r% a; S
  775.     else
    - l. ]% j( [, E2 }& R3 o* L1 `2 g
  776.       vp_x = viewport.rect.x - viewport.ox- [' J: ^2 {! m+ B4 G
  777.       vp_y = viewport.rect.y - viewport.oy- T: j. h/ `  {6 C& q  d' _
  778.     end
    $ z) W1 t9 V  H- U7 a, T
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y$ I  @4 z" y5 j9 ~$ u
  780.     item_x1 = vp_x + x + standard_padding 7 |/ w4 h( ~( V( G8 ]; }
  781.     item_y1 = vp_y + y + standard_padding5 T* ~/ Y- P; Y) N% _
  782.     item_x2 = vp_x + x - standard_padding + width1 s4 q% ^# i6 }+ T
  783.     item_y2 = vp_y + y - standard_padding + height
    # l  X  V, J2 c4 n
  784.     if mouse_x  item_x1
    : `, e) R7 T7 H+ S* ~- K
  785.       mouse_col = -1
    % m; D5 w. _8 e7 e9 ?8 C4 e# [
  786.     elsif mouse_x  item_x2& ]' |0 D8 u: q7 J! H& q
  787.       mouse_col = -2! w* ~; [$ Y- Z4 }8 h
  788.     else4 t- @' z- q4 {" m8 f$ S% F
  789.       mouse_col = (mouse_x - item_x1)  32
    ( b6 j" |4 _$ M2 g" M8 X0 d* K
  790.     end' w3 q1 }& ]0 w4 B: _; V( T, P5 b
  791.     if mouse_y  item_y1/ e* H* N$ Y2 Q0 g  q+ a! g2 t1 L
  792.       mouse_row = -15 P9 E$ ]* m* X' J8 d
  793.     elsif mouse_y  item_y2
    3 ]- N" G, g5 @' d$ g
  794.       mouse_row = -27 ~3 W7 L" m4 U/ |
  795.     else
    ! P2 h& j# G, j8 R8 Q  G% h3 t
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    8 b* P- V' M- ?
  797.     end' V5 w# `7 p* S& o' C
  798.     return mouse_row, mouse_col/ r/ c7 s! J+ z, L/ {
  799.   end
      j, v0 R6 |% I- Y4 O( b
  800.   #--------------------------------------------------------------------------+ N5 f2 H" y8 t5 }. G1 ^) I
  801.   # ● 获取文字
    ! k$ m" E. _" c+ f( d- r  L# B
  802.   #--------------------------------------------------------------------------
    # f# q' y1 ^2 g9 u. e' j$ I1 d
  803.   def get_number& u4 l& p0 a/ B, X1 o$ {% J
  804.     return false if @index == 9  @index == 116 q; ]9 b2 I- H4 y8 G; \
  805.     return TABLE[@index]
    . s: f" b! v5 t/ i7 `
  806.   end7 X! b6 o7 `& |& B/ u! a2 M
  807.   #--------------------------------------------------------------------------
    * F7 ?: X# u' Q. Z; I- S
  808.   # ● 判定光标位置是否在“退格”上
    ! Q! M- r! ]' S. A4 ]* n
  809.   #--------------------------------------------------------------------------/ X0 R1 ^9 p. i' N3 A
  810.   def is_delete
    / i4 `. Y: H/ `1 C# L7 ?! |
  811.     @index == 9
    % |  d4 z5 ]! p( q" j! W
  812.   end
    , T. {/ W) Y, [% ?9 n3 V5 e
  813.   #--------------------------------------------------------------------------
    9 B& L8 @5 A1 A8 {2 i8 Z2 }" e( c* O
  814.   # ● 判定光标位置是否在“确定”上2 j: P0 A  d, `+ Q3 d
  815.   #--------------------------------------------------------------------------: ^5 U/ E) N7 e5 j% f# Q$ N) L/ p
  816.   def is_ok) J5 j' |" {6 v# r
  817.     @index == 11
    9 H) o# {! K  j  W& I# m
  818.   end
    4 h( }7 ]& p% B; a4 F
  819.   #--------------------------------------------------------------------------
    , C( m9 }; @3 ]: _/ N9 ?9 z
  820.   # ● 更新光标
      q$ l! x$ }/ o" K  i1 L
  821.   #--------------------------------------------------------------------------
    # H  Q/ R3 V2 n$ \
  822.   def update_cursor3 S+ b0 [2 h5 Q
  823.     cursor_rect.set(item_rect(@index))1 I, l, K7 z' o2 A- V4 U
  824.   end! F! h- Y7 W7 _1 V
  825.   #--------------------------------------------------------------------------4 m5 T5 }- K; I8 S" u
  826.   # ● 判定光标是否可以移动5 \6 Z, X( C5 M' o4 S" o/ n* Q0 C
  827.   #--------------------------------------------------------------------------
      p' n2 |' H7 l! j3 t# U
  828.   def cursor_movable
    % s( e2 X# [2 f* K- X& Z! ?1 z# h
  829.     active* [1 \# U8 A6 M: P* x+ F
  830.   end
    ; z/ {: }# A: X' `
  831.   #--------------------------------------------------------------------------7 y/ k# `1 A2 D4 z
  832.   # ● 光标向下移动
    / O2 G- o3 ^; p" N4 H6 T9 F7 i/ C
  833.   #     wrap  允许循环3 s: H. z7 o6 V& I: B  ~( H
  834.   #--------------------------------------------------------------------------& y1 a; M1 w5 @* e+ G( M
  835.   def cursor_down(wrap)
    1 ?& \2 X2 a7 p. Z
  836.     if @index  9 or wrap2 h; Z/ u" I. x
  837.       @index = (index + 3) % 128 ?: o2 o( G4 [: g
  838.     end
    3 S3 M9 g: M8 D$ z7 r: R" D  x
  839.   end
    % ?) t, B9 I8 e
  840.   #--------------------------------------------------------------------------+ l9 M$ S* l4 a
  841.   # ● 光标向上移动# ]0 I- y5 ~* Z+ {
  842.   #     wrap  允许循环
    5 ?% Z; J$ |( {$ U0 e& p! m
  843.   #--------------------------------------------------------------------------
    - z2 V* a/ l! C* B
  844.   def cursor_up(wrap)$ H+ W& E; X0 [% \$ j( k# A
  845.     if @index = 3 or wrap
    . Z( \/ f" f3 s2 M5 Z% F5 w! i
  846.       @index = (index + 9) % 12
    ! P8 @6 V: r" B  W/ @
  847.     end
    9 J: l5 ]" D: W) J; D3 R2 C/ T
  848.   end
    9 g& _- s( _2 L
  849.   #--------------------------------------------------------------------------1 K$ j. \7 {0 i; Z/ B8 M5 q! T, b
  850.   # ● 光标向右移动
    ; b0 x3 h  @/ c5 \+ {
  851.   #     wrap  允许循环
    4 B7 h. `4 C0 s% b3 K. g2 I
  852.   #--------------------------------------------------------------------------
    . ?3 S3 z5 I6 Z1 ]8 g
  853.   def cursor_right(wrap)0 `3 H9 m* N4 C1 P
  854.     if @index % 3  2/ |3 C6 D' r' {! R3 X" K
  855.       @index += 17 f2 w- Z9 @. ?1 g$ d
  856.     elsif wrap& ^, g' a& W- B: \
  857.       @index -= 2
    1 U! @6 c  s+ A" u7 y
  858.     end
    7 r1 `9 P) s; Z
  859.   end
    0 \" M/ G& R- b- N
  860.   #--------------------------------------------------------------------------* `! f- Z+ P5 X4 z5 a! |# P
  861.   # ● 光标向左移动* F- p5 \# q( [5 y! ~! }
  862.   #     wrap  允许循环" ~6 E% k# e+ ^+ D  Q
  863.   #--------------------------------------------------------------------------
    0 Z5 L5 v* j" T3 i$ Z
  864.   def cursor_left(wrap)
    9 h2 f% ~9 W: B! L7 Q4 W# A: l
  865.     if @index % 3  0" }# T  b3 P" r' G% w9 c/ a: t
  866.       @index -= 1( Y! H0 a! _9 n1 d# @7 M- ]
  867.     elsif wrap. d; ?1 [2 m0 T9 D
  868.       @index += 2) \- M0 H' p, K# ?+ W; l$ p
  869.     end
    + Z4 o, B+ J# q" K& Q
  870.   end- Z" f  x9 V/ O6 q& Y) A+ }' P8 b5 l
  871.   #--------------------------------------------------------------------------
    ( N; g2 x# C: P  z/ I% Q" |! o
  872.   # ● 处理光标的移动
    ) `0 @5 A) x% T) m- }0 g& Z) g) s
  873.   #--------------------------------------------------------------------------
    / H; _0 l6 ]1 t. S& {+ K6 v
  874.   def process_cursor_move# z1 R# Z  x! I/ I! e5 p" K
  875.     super
    : X/ U) F8 ~) R5 ]/ j
  876.     update_cursor6 o9 y4 I' N% Z: {+ }
  877.   end7 @* v( @4 ^+ R7 [4 S) R% ~- N# ]. R
  878.   #--------------------------------------------------------------------------
    9 `% ]* a2 n: |9 \* J
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    : {. A% P2 E, }, Y5 j% r7 v2 Y
  880.   #--------------------------------------------------------------------------1 Y& W, P1 j9 ]  F
  881.   def process_handling9 t- f) c" _, e/ l. l* }7 D
  882.     return unless open && active
    & j6 y; h4 r* m2 {# D, e3 k/ Z
  883.     process_jump if Input.trigger(A)
    3 P$ \& k+ ~2 v: N! C' O4 W3 O  t
  884.     process_back if Input.repeat(B)
    3 G( ?. p' E: ^
  885.     process_ok   if Input.trigger(C)
    # o5 W  v- }# N. p) @, B
  886.   end8 i" Y; {5 X1 C0 A$ O, G- o0 a: H2 L
  887.   #--------------------------------------------------------------------------6 p) s1 n! p3 L/ u6 a* D
  888.   # ● 跳转“确定”
    6 E2 U  c) _$ G& a" s
  889.   #--------------------------------------------------------------------------
    $ N0 P: b  k0 b% ]0 v$ ], E
  890.   def process_jump# z) o( `8 ]) {$ N
  891.     if @index != 119 i# p5 p  P3 s( Y, k" c% V
  892.       @index = 117 \) l5 z/ V" g( T% a3 K  G5 T6 B
  893.       Sound.play_cursor
    8 s' G2 r2 `, X8 h% r5 _
  894.     end
    # x7 @  Z- }; M5 A1 [
  895.   end6 }' T' q' G0 [* g8 O! o
  896.   #--------------------------------------------------------------------------- F! n% l. v0 L4 O. u/ _3 f
  897.   # ● 后退一个字符
    9 q' M/ F+ W4 p/ |& R
  898.   #--------------------------------------------------------------------------4 w; D9 i" y1 K' y* o2 l6 a  A. a' M7 M
  899.   def process_back- K  i- F- e) d( S6 F1 ]
  900.     Sound.play_cancel
    ; e" x1 s0 d9 N
  901.     place = 10  (@digits_max - 1 - @old_window_index)' b' c% |$ l, a1 a
  902.     n = (@number  place) % 10! d) t# }, v: O+ }* g3 z3 ^# W
  903.     @number -= n  place
    ( N" \- a, \" g6 A# |4 B
  904.     @number_proc.call(@number)0 L, y* |$ [' n( {) N
  905.     @old_window_index -= 1 if @old_window_index  0
    + D5 b4 F2 O4 P7 G- u% A: E
  906.     @index_proc.call(@old_window_index)
    " X7 D" B+ e4 ]4 @3 ?6 _+ @5 s5 p3 [
  907.     @refresh_proc.call
    - J, l- {) I- r) s8 ?7 j5 g4 @7 g
  908.   end& Q  J5 s3 g; K+ k
  909.   #--------------------------------------------------------------------------/ U' |; G3 a: Q  y6 j. d
  910.   # ● 按下确定键时的处理- e& i9 M* Z7 e# y. |0 k( N
  911.   #--------------------------------------------------------------------------# o: f! @8 _' T( l7 O/ W; {
  912.   def process_ok
    6 y/ }: h  _) _: u  \4 S
  913.     if get_number
    . t/ j* v- ]+ ~/ n
  914.       Sound.play_cursor+ o3 B9 j4 t0 X2 L
  915.       place = 10  (@digits_max - 1 - @old_window_index)! s' d" U+ r1 s& b2 X, u) Q
  916.       n = get_number - (@number  place) % 10
    * L8 R7 w) N8 j, ^4 H/ t
  917.       @number += n  place" E" X2 s7 o# ~, A& W: b
  918.       @number_proc.call(@number)
    ! ?* o8 f3 n; L% d# R' ~
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    5 |" T7 P: X3 I' Q
  920.       @index_proc.call(@old_window_index)
    0 I) N; Z% `9 B9 ]1 n  P3 K
  921.       @refresh_proc.call
    ' m2 X* |  m7 ?
  922.     elsif is_delete3 Y6 w3 b' W& W& G, D/ ?4 n& A
  923.       process_back& ^' N: A# K  w% @
  924.     elsif is_ok2 {! J. m- E6 K! `
  925.       on_input_ok
    ) e. H2 j0 y& w
  926.     end
    ! k8 W1 W" C4 b9 q, j# j( L
  927.   end7 n1 s! x6 K$ s! r0 v8 r# z
  928.   #--------------------------------------------------------------------------
    # X7 B! W' M5 k" M3 u% z, l
  929.   # ● 确定
    $ G: n0 p$ Y/ ^) t
  930.   #--------------------------------------------------------------------------! [; E. k; J' K2 n1 D. l* \2 S1 m+ l/ [5 ~' c
  931.   def on_input_ok( [2 A. n" U4 }8 t: k
  932.     @index = 0( I& i' o7 d$ W. t( s$ [
  933.     @old_window_index = 0
    ; Y5 }. q) c5 m& l4 C
  934.     $game_variables[@variable_id] = @number
    * Y# l) w) I% t6 y' I7 l& K
  935.     Sound.play_ok+ o; c6 H! f2 Q$ O0 H' o  ]. G
  936.     @close_proc.call# k5 S, |' q) T
  937.   end# {' K8 o6 f' @; f. [! V" w1 A) C
  938.   #--------------------------------------------------------------------------
    & S6 E% x. w: F8 \; O
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置9 x! A; u# H% s- C$ J( Z
  940.   #--------------------------------------------------------------------------
    1 x1 s4 b- c9 G/ A
  941.   def set_mouse_pos! W  S- m; Z' ^4 _0 N+ D6 v# |
  942.     if viewport.nil # necessary!: Z6 a; m, X6 Y
  943.       vp_x, vp_y = 0, 0
      q" _- f+ x/ B; s" [
  944.     else
    6 r+ I) Y! F  w% ~5 m4 j1 i
  945.       vp_x = viewport.rect.x - viewport.ox
    1 S; v+ L% h' x
  946.       vp_y = viewport.rect.y - viewport.oy
    : R1 ^' ?0 u: x9 D0 U( j
  947.     end
    / g, P6 P9 ~7 a' K9 n% h
  948.     item_x1 = vp_x + x + standard_padding
    ( @( @: J9 e% L& B
  949.     item_y1 = vp_y + y + standard_padding
    . y& P* N4 D; A% ^. ~
  950.     get_index = @index  0  0  @index
    $ W9 r/ y  K, G4 m3 F
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)$ z$ Z& {2 J$ {1 n( m
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)% {. Y- s: t1 _- y6 T
  953.     Mouse.set_mouse_pos(new_x, new_y)& H! M" ]1 v. U8 b- ^8 Q( w
  954.   end
    ! J- S" [" k+ q+ N
  955. end( [# k1 K( d& R6 Z7 t! z6 M( h
  956. . ^% {- n' Q% a6 T. ^
  957. #==============================================================================) ^" n9 G% P. [2 I5 |$ _
  958. # ■ Window_Message
    5 I$ Y: @  ^5 D; }0 P$ }: B  k
  959. #------------------------------------------------------------------------------" S4 _, P( W5 ?: @
  960. #  显示文字信息的窗口。
    ' j7 |, P/ K- A/ R/ o6 [! _. ]$ C
  961. #==============================================================================
    7 j/ \7 Q( S8 k# Q
  962. class Window_Message  Window_Base; h8 r5 ]/ }& D7 U
  963.   #--------------------------------------------------------------------------
    % E$ V8 B& A9 t1 B2 }) u( g
  964.   # ● 处理数值的输入(覆盖原方法)& f* t1 u+ ?; n! \- k5 i6 t% W
  965.   #--------------------------------------------------------------------------
    % }. [- o# J* q+ h& Z
  966.   def input_number! U7 T% J7 A0 s4 R/ O; J1 f5 {
  967.     @number_window.start
    0 Q4 |( S3 q, i
  968.     Fiber.yield while @number_window.extra_window.active  V' e5 `& o# v$ L1 T. ^- K1 J( `
  969.   end4 K0 ^$ _3 B7 s# }8 q. |
  970. end5 ~. [$ _* o3 ]/ b

  971. , q9 S# ^! h, r- ]
  972. #==============================================================================
    + m# X! X2 s- c; U" F3 V) c# e
  973. # ■ Window_PartyCommand
    * O4 ]! T/ |9 }' `: `# ^6 B! m( U  }9 a
  974. #------------------------------------------------------------------------------
    " _0 z4 U5 L6 ]3 w
  975. #  战斗画面中,选择“战斗/撤退”的窗口。, O$ F: G. G& V! y+ D! C- e
  976. #==============================================================================
    3 R8 r3 v6 h9 k2 M" g1 K- s/ f6 K; L
  977. class Window_PartyCommand  Window_Command
    & S- G6 I. V7 t
  978.   #--------------------------------------------------------------------------* s3 J# V$ `4 j' p
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    % C; j+ Y6 b* [2 O
  980.   #--------------------------------------------------------------------------
    + u9 _, X9 I% E1 [, n1 _0 n
  981.   def set_mouse_pos
    2 W  D2 S& \9 P0 a
  982.     if viewport.nil
    ) }* a9 D$ ]4 V9 n8 k- v# h
  983.       vp_x, vp_y = 0, 0, ^/ O2 B8 Z/ x4 P; O  p0 K# o
  984.     else+ h% c' v8 e& p% r
  985.       #vp_x = viewport.rect.x - viewport.ox
    ( z" r. U4 ]0 G8 m# |
  986.       vp_y = viewport.rect.y - viewport.oy
    * y9 J$ Y1 Y, g$ R, N9 N! G
  987.     end& m' \$ t/ |# o) [, c
  988.     item_x1 = x + standard_padding
    # s& ~' B6 G, C/ ?% I
  989.     item_y1 = vp_y + y + standard_padding
    ; |7 [( n; E. _  h( f) q
  990.     get_index = @index  0  0  @index
    6 r% ~" d) C$ |. P& \4 Z) [
  991.     row = get_index  col_max - top_row
    ; x9 J" |5 i0 m4 ^0 ~6 O3 P" _1 P
  992.     col = get_index % col_max- ~1 ~: `, ~$ D8 [1 N, u3 Q
  993.     new_x = item_x1 + item_width  (col + 0.5)
    9 G7 X4 D' u9 f4 \
  994.     new_y = item_y1 + item_height  (row + 0.5)
    3 b, `/ }6 D9 R& _9 ^
  995.     Mouse.set_mouse_pos(new_x, new_y)! p$ n* \2 f2 i2 d3 p& J
  996.   end) P9 r# a6 q& p) G& H$ G: G$ r- v
  997. end( r* u- M) q  k. f' T

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

  2145. % u- D: j; E4 R- N% R$ p$ ]
  2146. #==============================================================================
    2 E3 v8 q9 u) e' J1 r1 D
  2147. # ■ Game_Map. D+ R2 h4 K" b
  2148. #------------------------------------------------------------------------------
    ; \+ x  S* \* G; T- e
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
    & S/ q  d: E4 Z" M' D* X
  2150. #   本类的实例请参考 $game_map 。, a  a5 G! _- t" R
  2151. #==============================================================================# I" p0 K& b# P9 z: B) {
  2152. class Game_Map
    6 b6 g5 U: l6 L# R& G8 V
  2153.   #--------------------------------------------------------------------------' R: _0 n% u& ^" G' P
  2154.   # ● 定义实例变量. g( b3 n( \0 i3 d
  2155.   #--------------------------------------------------------------------------7 l- g/ B9 K0 s' C5 S, ~
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
    " t. c+ S3 {- Y
  2157.   attr_reader mouse_map_y # 同上3 n  t) e0 I8 e: V( Q
  2158.   #--------------------------------------------------------------------------8 z. U- F4 b; W$ C* F7 k* L$ S0 N
  2159.   # ● 初始化对象& u9 u* I  @! J3 b- T3 v' n$ J( k, [
  2160.   #--------------------------------------------------------------------------4 k) a! M9 P5 O$ H* X
  2161.   alias sion_mouse_initialize initialize2 q. G$ L- t  A6 _/ R# @. v! b. O
  2162.   def initialize
    + Q0 L* R' X1 u; _; |, m5 B2 x
  2163.     sion_mouse_initialize( {5 _" f3 T" q) G
  2164.     creat_move_sign  ###0 v5 t8 h7 g& e, w
  2165.     set_constants2 J) q, A+ G5 T3 p: u
  2166.   end: L& w% k7 m( b2 \
  2167.   #--------------------------------------------------------------------------
    5 O/ d9 T9 V0 C% h6 a1 s0 O
  2168.   # ● 更新画面0 s# K( k. ]* g1 V" u
  2169.   #     main  事件解释器更新的标志
    # ]% k' x! a+ \+ b( e. Q: I" |
  2170.   #--------------------------------------------------------------------------6 [8 [& E6 \' Q: H
  2171.   alias sion_mouse_update update
    : d  s0 e* Z# F8 V0 h, a# O1 D
  2172.   def update(main = false)3 C! t/ @& k- O+ ]- h9 \  M/ Q) j
  2173.     sion_mouse_update(main)7 A9 q/ l4 t* r8 P
  2174.     update_move_sign2 }/ N" Q* s  B) O, Z* I
  2175.   end
    2 g( |! X0 X! j4 \6 A; l& R+ m
  2176.   #--------------------------------------------------------------------------
    % o( O6 m: g9 @% p% q2 n4 q. T
  2177.   # ● 创建显示路径点的事件
    8 U2 r4 A: U4 z  H
  2178.   #--------------------------------------------------------------------------, y4 q0 c* a! n6 U. b
  2179.   def creat_move_sign
    " }; `( B5 v4 T- _2 ]$ y
  2180.     $mouse_move_sign = Move_Sign.new# S, j8 B4 a& n: N6 n" `
  2181.   end
      K% d' {* B$ n- c# F
  2182.   #--------------------------------------------------------------------------
    , ^* ^8 L$ E, E! ?" T4 M1 o
  2183.   # ● 更新显示路径点的事件
    8 n1 K1 O( N: d0 l7 h5 c
  2184.   #--------------------------------------------------------------------------
    : Y- k. I2 z) W1 g4 q
  2185.   def set_constants8 A, |" u% T. J* ^. Y% C
  2186.     @mouse_pos_setted = true
    ' d1 u- P2 b! T) D/ a- T" j* k0 H
  2187.     @set_pos_prepared = false
    0 |8 C9 Q0 B4 c: Q
  2188.     @mouse_old_x = 0
    * m# {! T* t, r9 D9 ^
  2189.     @mouse_old_y = 01 m' N# _4 t7 Q! b
  2190.   end3 _8 p, `+ ?# J5 N) O0 n
  2191.   #--------------------------------------------------------------------------
    - U8 A! s: j7 Q* d4 s2 b1 f
  2192.   # ● 更新显示路径点的事件, L. m; A8 s3 ~. R( {4 i) n7 H5 n
  2193.   #--------------------------------------------------------------------------# X" \, B2 P. h4 g- l
  2194.   def update_move_sign
    , V1 W7 A9 h; b( m
  2195.     $mouse_move_sign.update
    & V5 g( J* }$ z, k" n9 S
  2196.   end
    ' a8 l, B9 Y/ k: S" i8 h  Z
  2197.   #--------------------------------------------------------------------------
    ! D4 X/ Z3 w, B9 {9 P* k4 @
  2198.   # ● 获取鼠标位于的地图块的x、y坐标9 ?/ P! M/ g, M* f$ `% c$ @
  2199.   #--------------------------------------------------------------------------! B, ^( W! w5 P; _3 X6 d  K. q! Q
  2200.   def get_mouse_map_xy& H' Q+ J3 W5 G0 g5 |; y" @  c) U1 T: F
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y9 \1 }# g6 C: g: ^, q% n% O0 F
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i): {! e# X, f* D& }
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)1 K3 {5 [" a4 b/ t0 Y5 S8 t) p
  2204.   end
    * |6 `4 K" M8 [" r& P
  2205.   #--------------------------------------------------------------------------
    0 v. ~) n% i2 D8 m( ^
  2206.   # ● 返回地图画面时重设鼠标坐标8 Z# w" C$ {! N! F
  2207.   #--------------------------------------------------------------------------! t& n- t( W4 a  E
  2208.   def reset_mouse_pos4 l( Z! P# o- ?* |9 ]) V
  2209.     return if @mouse_pos_setted. o: y( M! ~4 e6 l& P' t) I
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    / P! h6 }; ?7 Z8 F5 |
  2211.     @mouse_pos_setted = true
    + l6 N. o5 T" k+ z. G  q* w7 R
  2212.     @set_pos_prepared = false
    # [7 j# Q! {; ^' X' a  a% A
  2213.   end; A% g7 _/ J& d% N2 S( P* R
  2214.   #--------------------------------------------------------------------------
    + c0 p* p/ j3 e/ u' l+ ^
  2215.   # ● 重设鼠标的坐标4 ]  \, ^+ `" k! m$ g
  2216.   #--------------------------------------------------------------------------7 r0 f+ v9 h/ N5 {0 k  H; g, d# g
  2217.   def prepare_reset_mouse_pos4 d2 w7 x- a. N, O4 O( }2 q
  2218.     return if @set_pos_prepared; [" K8 Q2 M9 e' u) r# z# Y+ _. A1 _
  2219.     @mouse_pos_setted = false
    . g$ y) ~$ @& S1 L
  2220.     @mouse_old_x = Mouse.mouse_x
    : @% E! h  i6 h" c
  2221.     @mouse_old_y = Mouse.mouse_y
    7 l  y/ L7 x5 q7 h9 R9 D4 g6 m
  2222.     @set_pos_prepared = true: `8 l4 Y; a$ g8 a5 X
  2223.   end
    % B( U4 d0 N# q- `& E
  2224. end& {# K6 R- k% g! [

  2225. * {/ x/ L/ H! I8 Y# h3 N
  2226. #==============================================================================  y$ a& ~  _$ s
  2227. # ■ Spriteset_Map: q' m3 t0 D4 u1 f; i" n
  2228. #------------------------------------------------------------------------------  ?. T+ i: o/ x0 _  ^* ^2 x- J/ l
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    , N, ~0 t: _* Q
  2230. #==============================================================================
    0 w- B& s5 |3 D/ O( g# M
  2231. class Spriteset_Map
    4 u& j  R8 a, S" @
  2232.   #--------------------------------------------------------------------------* i# `: y. E6 b4 R) Y4 C3 F. Q* K
  2233.   # ● 生成路径点精灵1 a1 i. ^7 Y7 H. b" T
  2234.   #--------------------------------------------------------------------------
    6 C( S8 x6 S5 v3 Q
  2235.   alias sion_mouse_create_characters create_characters: A. e5 z/ O2 K
  2236.   def create_characters7 N3 \6 S0 |$ |/ {' X# S
  2237.     sion_mouse_create_characters% D  l# N0 h7 B: a# X) X
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    ; @  U; K) j/ Z! w5 ?3 E
  2239.   end$ ~" ?0 B0 w/ b
  2240. end
    9 d3 m8 J2 F, N8 N" Z- V1 s/ [
  2241. + s& {' X2 N4 Z. r
  2242. #==============================================================================
    + C/ V; ?. O0 A; r
  2243. # ■ Scene_Map
    5 ]' m: ^6 }/ d8 O, J  }4 N  K
  2244. #------------------------------------------------------------------------------
    * s4 u' Z4 V% o4 l  L
  2245. #  地图画面
    + S! f8 `6 h2 P9 A" L. e8 A* J
  2246. #==============================================================================. A% [0 r4 ?+ M8 [' r* @. p+ y
  2247. class Scene_Map  Scene_Base5 D& z. \( R0 G& b# [
  2248.   #--------------------------------------------------------------------------5 e) S: c) A4 R6 c, f" Z1 e% a% N
  2249.   # ● 画面更新
    ( x# T6 `3 u$ x6 y7 P
  2250.   #--------------------------------------------------------------------------" I' C1 v, N! l
  2251.   alias sion_mouse_update_scene update_scene5 Z; m6 N* W( E, d% u+ O% t
  2252.   def update_scene
    ! D) G0 {8 i! l! R7 m  V5 r
  2253.     sion_mouse_update_scene. f+ q  }0 }$ W! c8 E! n+ V
  2254.     update_mouse_action unless scene_changing& t( E: C( B  i: v
  2255.   end' N+ c3 _7 z1 q9 J
  2256.   #--------------------------------------------------------------------------
    , a. D: [, _# M  w; M" |. n( Z
  2257.   # ● 场所移动前的处理7 [, {4 L  ~: _  @2 c( g' w
  2258.   #--------------------------------------------------------------------------
    ! E! F7 ~5 F- p" W7 {4 o
  2259.   alias sion_mouse_pre_transfer pre_transfer; g5 D  Q  K" [9 h
  2260.   def pre_transfer' \0 ~4 B0 v! b6 C: Y5 L+ x1 I% T
  2261.     $game_player.reset_move_path
    0 N1 m  C; w* k# ^/ ~0 [
  2262.     sion_mouse_pre_transfer; P6 m  F3 O: A0 A" @2 s
  2263.   end& x6 I- w' \/ M9 h
  2264.   #--------------------------------------------------------------------------
    : M, M- L, T  g7 Y
  2265.   # ● 监听鼠标左键的按下8 Z) ?5 o) V9 x) I2 K# i1 k
  2266.   #--------------------------------------------------------------------------6 t* x0 j* \+ T1 {; k4 R: z7 M
  2267.   def update_mouse_action
    ; o6 j+ M7 M4 \5 R
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    6 M; o8 b& D) J; l$ T- {' O
  2269.   end
    0 p7 o' N* C8 b1 C7 A
  2270. end
    ; ~. {" V- T% h! |3 M& r8 z
  2271. / z( ~( G1 i" Q" Q% x' w
  2272. #==============================================================================
    $ W5 @+ L/ r, |8 }
  2273. # ■ Scene_File# W5 N# o3 l( p% N! G
  2274. #------------------------------------------------------------------------------
    0 i1 F3 ^$ j; _; Q
  2275. #  存档画面和读档画面共同的父类
    & Z) \9 t  n0 \- d8 t4 [
  2276. #==============================================================================/ g2 s( H/ K4 U- {
  2277. class Scene_File  Scene_MenuBase2 N% Q$ N" k6 Z3 W6 [4 [
  2278.   #--------------------------------------------------------------------------  w2 Q3 b3 k8 {- X2 O6 c
  2279.   # ● 开始处理
    2 ^  J6 k' a& m  ~
  2280.   #--------------------------------------------------------------------------. u4 ?7 z. k. y& [' U2 R
  2281.   alias sion_mouse_start start
    0 P- n( U/ T* D6 g8 m# V
  2282.   def start6 A: }# _2 g0 X+ [
  2283.     sion_mouse_start* q1 j& i' k6 C' I1 }
  2284.     @move_state = 0! q; Y( y, P( B9 m3 i
  2285.     set_mouse_pos+ X3 j; G$ r, J2 _
  2286.   end
    0 l% S7 x( f# \, H3 k
  2287.   #--------------------------------------------------------------------------2 N- K4 ]* P" b* H' j( P" X8 J
  2288.   # ● 更新画面4 |+ C# _- S4 V
  2289.   #--------------------------------------------------------------------------" y% i3 E% _4 _) e
  2290.   alias sion_mouse_update update
    + w2 Z6 _' R- o# u
  2291.   def update
    : \$ g) n: f7 {. \# e" b/ F5 ]
  2292.     sion_mouse_update5 N: K8 k" x0 j. ]4 \: ~
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos" V( V' g5 F7 Q: h2 u+ V
  2294.   end& @$ B- p5 g% @4 ~! a$ F2 A
  2295.   #--------------------------------------------------------------------------
    ) a$ t  m4 D  b& \. q5 v1 x! ]
  2296.   # ● 更新光标
    3 Z" p4 [1 ]: Z. E8 q0 E
  2297.   #--------------------------------------------------------------------------
    9 E2 u+ w5 M; s5 i6 h! }
  2298.   def set_cursor
    : A7 S6 j- R/ F  }
  2299.     @move_state += 1
      ?1 X" P- k/ N7 }1 Y
  2300.     last_index = @index
    6 @: m# F' V+ T' j3 I* g9 q
  2301.     if mouse_which_window == -2) U# G) @  u& ]& J$ S. j" U
  2302.       if (@move_state - 1) % 6 == 0& ?  Q* j5 z, k0 t9 y( e
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    . T" o) S% \/ m# {" Q* d1 K, Z$ ~
  2304.       end
    ) T; J- P4 `& \3 w4 L0 O8 C
  2305.     elsif mouse_which_window == -1
    * a2 l5 h) n* T8 ^  j( {: O# I) _
  2306.       if (@move_state - 1) % 6 == 0; y' x- @' D$ j# N8 Q. {+ S
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    2 @  Q- u* I* v! K& t
  2308.       end
    3 h: I8 z7 N5 m' V0 i1 p" D
  2309.     else
    1 Y8 R9 t0 d( b2 Q/ {6 z  ^. u
  2310.       @move_state = 0+ l: p+ P# |' j# n2 J% `1 @
  2311.       @index = top_index + mouse_which_window
    6 a' j2 g9 z4 r" x7 e; e% f
  2312.     end( S; k! K; @9 }) P# s
  2313.     ensure_cursor_visible# z0 j; V0 ~3 K# _) ]
  2314.     if @index != last_index
    $ X* z' ?4 F3 u; H8 e
  2315.       @savefile_windows[last_index].selected = false) w8 q. ~; _& {5 s2 M0 n
  2316.       @savefile_windows[@index].selected = true( y& K2 v0 B/ H* Z! |6 I
  2317.     end
    7 r" C9 N3 n4 n5 V4 [1 s5 P$ c
  2318.   end, k; {3 D& u2 G$ e) Y5 f
  2319.   #--------------------------------------------------------------------------
    ) U3 j0 m+ I+ e& j2 f
  2320.   # ● 判断鼠标位于哪个窗口
    , C  `' e3 Q. }7 _
  2321.   #--------------------------------------------------------------------------+ T3 d. l; I% E7 `0 a" v
  2322.   def mouse_which_window$ ?7 O# x% N8 f3 {) m3 C; F
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y# z4 g1 W2 Z8 g. W* h; y8 g( _
  2324.     if mouse_y  @help_window.height + 14. r* d# G7 e& L, o: z* A
  2325.       mouse_row = -10 A4 l0 ?# s6 s& p; I
  2326.     elsif mouse_y  Graphics.height - 148 m2 d2 m- Z+ f
  2327.       mouse_row = -2$ ?' Z6 q/ q! `( m6 b
  2328.     else
    " a- v& E5 A9 V8 ]* }
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ! r( o0 }0 T4 }" j: F0 V
  2330.         (Graphics.height - @help_window.height)
    " Y) ^9 ]+ @. i2 F& V! u7 X
  2331.     end9 V* ?! `7 B" ], X0 P
  2332.     return mouse_row! y% |- `6 c8 T3 \  e4 \! ^
  2333.   end
    0 b5 a( N/ C; v9 [+ Z% M
  2334.   #--------------------------------------------------------------------------$ ?. H& l8 c2 U$ ~& f9 E! ]
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置  ^( S/ u+ N1 d3 D
  2336.   #--------------------------------------------------------------------------3 h  L9 }  e9 j5 t+ R; K
  2337.   def set_mouse_pos
    . D! D( N  q8 y6 a; C
  2338.     new_x = 40
    $ C' n# i- ]9 O9 T/ z. s
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    ! Y) x& x$ r4 J
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    % b) L5 N5 k- A6 J6 m/ _2 D2 a
  2341.   end; l$ W# y0 ^* J7 o' u; R9 J7 a
  2342. end
    6 r3 t# ^4 B! b* ?* c- T3 A5 [% V

  2343. ; C* i, e- C0 C" `! G! O; [4 U$ D
  2344. #==============================================================================/ C6 ^  v$ X- z2 q. w
  2345. # ■ Game_Event
    ' t# w2 h$ u" Y( }0 k
  2346. #------------------------------------------------------------------------------
    1 N2 u" b, @0 ?) N& r
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。* a& o0 ^6 G" B5 w& P7 i, F
  2348. #   在 Game_Map 类的内部使用。9 }8 R8 e# {! E( A/ i! Z
  2349. #==============================================================================
    & {' l. G- Q5 o; v9 ^; @
  2350. class Game_Event  Game_Character7 d' j; v5 r9 T# P# s; G
  2351.   #--------------------------------------------------------------------------$ r8 W. z2 F$ `; Y
  2352.   # ● 事件启动
    6 d4 p& V6 P* J' j. e& I
  2353.   #--------------------------------------------------------------------------
    # ?. |6 j& G7 v7 a
  2354.   alias sion_mouse_start start9 I. f- b& m: o2 L3 ?
  2355.   def start
    7 I9 }8 }" r& J3 Y/ g/ j% h
  2356.     return if mouse_start && !Mouse.press(0x01)
    3 y4 Y& I2 o4 Z/ g  H- J+ ~& W
  2357.     sion_mouse_start+ I; h7 o' A* p, M
  2358.   end
    1 E' @, u- D9 h. H
  2359.   #--------------------------------------------------------------------------
    ) S+ ~+ O) q* e
  2360.   # ● 判断事件是否由鼠标启动
    9 H+ l8 f# ?2 {2 w$ r$ Y
  2361.   #--------------------------------------------------------------------------
    8 n  t* R3 \- Q: @7 \" r
  2362.   def mouse_start
    % Y, h% ~" w) m8 }& b' e
  2363.     return false if empty9 N1 L# L$ j% }4 M6 o
  2364.     @list.each do index( s* F! c6 E! Q8 I! \
  2365.       return true if (index.code == 108  index.code == 408) &&, G, I2 j4 ~. S
  2366.         index.parameters[0].include('鼠标启动')
    - D+ Y1 n# ^5 |0 O9 G: A: C  H
  2367.     end
    * @: ~$ f' W/ e9 N
  2368.     return false
    3 J1 p) Y$ Y) _5 x. a1 T- X
  2369.   end
    + A* r" M' G' @4 p
  2370. end7 m1 [5 ~2 I% ~9 r6 h8 p' i
  2371. % s: \" t8 {* {- K
  2372. ####泥煤的height! q* ^. d6 v, P* V) e* O" i5 q
  2373. # @height = height0 c% h7 E- k$ J: B) `: j& U) p. c
  2374. * j: i- f7 B4 @, [. C8 u
  2375. class Area_Response4 |5 P& J8 q) V
  2376.   attr_accessor type6 A. B  [' _  T0 Q
  2377.   attr_reader ox4 u4 J. g% d7 _. e
  2378.   attr_reader oy
    . h* U5 j* e0 b% X
  2379.   attr_reader width/ R' |' g; U- x# j( @4 u
  2380.   attr_reader height
    $ z5 Q5 J( A' m! Y
  2381.   attr_reader switch_id
    + Y5 l  v% D9 E1 X
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)+ j8 f4 U. N- ?  n
  2383.     @type = type! S& c( x; Q/ L: |
  2384.     @ox = ox
    7 U' E/ K$ V* l) X/ ]$ K8 U- z
  2385.     @oy = oy! }( i. {/ y6 O
  2386.     @width = width: Z5 {$ M2 V* ^% q) S$ f
  2387.     @height = height
    ) H1 u; v0 X1 d2 R1 {2 f
  2388.     @switch_id = switch_id
    7 \( q0 h) z$ q( R
  2389.   end
    , r( i9 J' ~2 U) E3 @
  2390. end" ^. p: n' M5 V  U& M* O7 z0 n/ f
  2391. ' i8 ?7 \- g' M6 |: b* v0 w: J
  2392. $area_responses = []
    . F! V  }; ^2 C+ E  [4 D, M( C
  2393. % `3 k  @5 u  G
  2394. class Scene_Map
    ; Q+ E% e- B+ O; F, T
  2395.   alias update_mouse_2013421 update_mouse_action
    / y& d+ R! L( F* R1 n
  2396.   def update_mouse_action
    1 D( H; L0 d1 M: ]7 I
  2397.     update_area_response% [+ F# b% |, n! k. ]
  2398.     update_mouse_2013421
    9 W; g6 D0 h5 @; _; P4 o% Q
  2399.   end
    " V3 F, Q* f  C- x+ j3 Y3 S0 w
  2400.   def update_area_response" E2 l! i, C! e
  2401.     responses = $area_responses8 C0 f0 B# q& R1 T- P
  2402.     responses.each {response
    + c6 z3 X# `' k+ J5 L
  2403.       ox = response.ox% @" I/ R0 x3 w" L
  2404.       oy = response.oy2 t( [  \$ H0 x
  2405.       width = response.width3 F# n/ r9 i: @3 W* u# V8 K$ V* i
  2406.       height = response.height
    7 ^* |" {9 _3 q: a+ w
  2407.       switch_id = response.switch_id
    ) p% f, q1 g0 r# u) z# p5 o8 V
  2408.       case response.type3 F/ o/ m7 [. ~
  2409.       when 0; w, P/ i7 p9 s+ ~( z
  2410.         if mouse_in_area(ox, oy, width, height)
    & _4 N+ @/ k: K  c* F7 v% E  @
  2411.           $game_switches[switch_id] = true
    9 H, r; q9 s- E, A- s+ b# A
  2412.           $area_responses.delete(response)( l% @/ o3 t0 d3 T& o1 f- Y
  2413.         end! e# z9 k4 C6 K4 e7 V( V
  2414.       when 1& W, Y( o5 h. m/ n9 U
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)' u8 ~% v0 N% f
  2416.           $game_switches[switch_id] = true
    % H- a, M0 W) _0 Q0 I, C
  2417.           $area_responses.delete(response)
    ) V0 j4 T8 O5 N9 j% M
  2418.         end
    - e) r$ q" V" b
  2419.       when 21 f* O1 b( g, f& A
  2420.         if mouse_in_area(ox, oy, width, height)
    0 H0 q- W! Q7 y" G" ^- R
  2421.           $game_switches[switch_id] = true
    8 w: i8 Q7 Z" {" l  H
  2422.         else0 ~5 q1 C* \8 e3 D/ ]0 E
  2423.           $game_switches[switch_id] = false$ ^+ ?# D  A+ h  P- j6 r+ V9 L
  2424.         end& r& [2 c0 N3 q# A8 i6 T
  2425.       when 3# d, m* N' ~& [( F+ ~
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    & v; ]9 @. |$ H6 w) K% \
  2427.             (oy - $game_map.display_y)  32, width, height)9 O' Q+ \. |  R' L
  2428.           $game_map.events_xy(ox, oy).each {event7 {" X- g4 b. E) \) L' R
  2429.           event.start/ t0 L; ~, ^# i! l8 A
  2430.           $area_responses.delete(response)+ K/ F* v5 c- u, m  O
  2431.           return
    6 W! E% X; x* R0 b2 T
  2432.           }
    " }6 o& N. K1 S& V1 R
  2433.         end" T* ~/ S9 V& a$ S# _/ @) B2 t
  2434.       when 4
      Z) R1 h" K: h; i7 f2 Z
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,, E( B2 I/ r$ }* O' P3 o; I
  2436.             (oy - $game_map.display_y)  32, width, height)4 Q+ n+ t9 U# _+ b- b7 D
  2437.           $game_map.events_xy(ox, oy).each {event% }( N0 G# _/ r5 F7 S. G' |
  2438.             event.start6 G* X3 w1 e8 z* B
  2439.             return" ~' H1 f" c+ ]5 _8 ?- T! X
  2440.           }
    4 }$ j+ @. m5 _8 _
  2441.         end  E* ~( R1 h" p4 ~! H
  2442.       end% g% O% a3 N& z
  2443.     }
    " H4 }, r  a6 }
  2444.   end
    ! x# {5 C& T( b4 M
  2445.   def mouse_in_area(ox, oy, width, height)
    ' j" ^' ]! }- P! [: e+ K
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    ( p+ o+ D  M& X
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height: y0 X' u4 u# M9 n6 S8 q! o+ T
  2448.   end
    " S8 G5 j. I6 d9 ]% c3 {9 i7 |
  2449. end, ^0 ]$ K. U; _& i2 S0 ^+ A
  2450. class Game_Interpreter
    & Z; {8 I* q1 b* C# c
  2451.   def area_response(arg)
    1 a% c; b* v5 m3 I% ^1 ~1 p+ `
  2452.     $area_responses.push(Area_Response.new(arg))0 Q* u1 T) j+ U: f% {9 r% ]
  2453.   end
    ( a7 s! V5 t( M5 R" N9 K5 c1 C6 N
  2454. end7 c4 F: [' d7 i7 Q  b) Z1 A& s1 q* H6 c* z
复制代码

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

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

GMT+8, 2024-9-20 21:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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