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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================3 `" i* w/ f$ R
  2. 2 J4 ?/ K) z9 r* c; c2 [
  3.   Sion Mouse System v1.3e- H/ p/ I0 B. `# H
  4.   
    " ^2 g: B/ s) G) F2 g9 M' k4 A
  5.   Changlog9 }! w! T! P1 y3 V% B$ F2 h
  6.   / S) h) P/ P1 V) `
  7.   2013.4.21 v1.3f, U+ H3 u$ p+ H* ]. j1 z
  8.     0 U5 k- Y" S4 b+ w7 u5 O' F2 C' W
  9.     1.3f 卷动地图 bug 修正
    3 Q4 t' \* q: s+ C  e* b9 Z3 c4 m. J
  10.    
    6 h4 R& _! |( G% a0 _5 `& U- P
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口# }: _3 q3 m6 {/ N8 \
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内6 Q( a- J% W3 s, m  e6 [* T  T
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    ; x! y5 K! t+ W+ v

  14. * S/ _8 R# H, P- |* `
  15.     1.3f bug修正
    2 Y* I/ m- L+ p
  16.   & f7 _; w8 |8 _* F" P
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    ; I0 ]! V, ?% d) P5 c0 N5 c6 _7 m
  18.           关闭菜单时,鼠标是否移动到原来的位置。( ~$ Z- [3 f: D+ ~( ?) D
  19. 7 ^, H+ ^+ E) [: q8 t
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处9 {; \2 J/ [8 b6 X

  21. % R: f# r/ J7 G: [- [/ S9 B
  22.     1.3b 修正一些罕见的bug;3 W2 [; z2 j. S7 i$ V
  23. 6 G  P  @$ ]- P  w3 K, |1 x
  24.     1.3a 代码小修改;
    , Z. b* z: }* }6 R( z
  25.           加入了鼠标点击启动事件的功能,
    ) W) P2 H- n* f; E
  26.           在事件中加入“注释”: 鼠标启动  ,& |- h- _3 I; ]- C: y
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    3 }' u& w6 C' c6 w
  28.   0 _- P, i/ H% q, m% I. K
  29.   2013.2.12 v1.2
    ! m$ t$ V: F0 l  o9 |2 |
  30. 1 P. T4 A9 l4 o8 n. N  |5 `. v
  31.     寻路逻辑优化;
    " {$ s2 H# U) ^" j4 H6 p
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;2 ^0 C& ?; _4 B7 Q  O
  33.     现在支持用鼠标来操作载具了。
    8 K9 ~7 D: R/ L  _8 K2 S$ z& n0 R
  34. / C% Z; X& o" j$ Q9 r6 t
  35.   2013.2.8 v1.1
    5 i/ V; V7 K" k6 W. e- d  e- R( D
  36. 9 B+ }; d7 [, I* K& U
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    3 y: L3 ?& r9 t
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    7 h  \0 S) R. f* f" ^
  39.     移动时,路径指示点的绘制更加稳定;& a7 q, w. x9 k
  40.     现在支持默认存档画面的鼠标操作了。  w( y0 T# ^8 v3 v( B$ q. M6 h
  41. ( J  R- ]  q* o# c! J

  42. 8 k# k) h* F% d
  43.   OrigenVersion
    6 `, z; N5 i: \' y
  44.   5 h' x) Y' c+ o' I, P
  45.     2013.2.7 v1.0
    6 C; Z  ^" J2 Q  V* q- f1 u

  46. ( o4 h3 x, V: x5 i( [* @
  47.   主要功能- d; Z% ]; p$ @$ A6 h
  48. ! x+ D$ ^$ ?% v* T  @( L. K! H
  49.       使用鼠标进行各种操作...% D5 H* K- M! j( {. E7 l: g" Z# V
  50.       将鼠标锁定在游戏窗口内6 ~: v( R6 Z* u) D8 m" ]5 e
  51.       自动寻路,按住 D 键可以扩大寻路的范围* G# G8 J6 u. W6 B! v  t- z+ h
  52.       双击鼠标进行冲刺
    1 B& b) H4 n) Q$ n: G6 [
  53.       更改地图卷动方式以适应鼠标移动
    ) E+ Y6 L' w/ H
  54.       变量输入框改良
    ; ?: V" k/ y1 V9 c% _' e
  55. 5 H( I- k" u2 i/ F+ U
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹/ A# M5 ?6 |3 p. d2 }
  57. ( s' c0 Q- @! D
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    " N$ i3 r4 |5 K& r. k( G1 S
  59. 9 ~, ?, A/ r. R6 n/ C7 u$ V
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
      V1 h- M# B1 K3 {) _

  61. ' {1 T& ?) Q$ l! `2 ?
  62. ; ?1 ]9 d+ Y; L+ |' c# U
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★/ b  E( }6 P' e) B
  64. ( i/ j7 f- g, J( p$ H4 ]& T# Y
  65. $ ^) D" a6 C4 H1 x! C
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示) A$ Z  H/ M4 z! }# y

  67. : m. o# Y! `* {, ^
  68. #==============================================================================
    ! J2 P( \/ r. A% d' X
  69. # ■ 常数设置 9 m0 P1 J+ K$ t' ^4 @" U+ {
  70. #==============================================================================: W% ]2 Q  x* g+ a- L" B7 ]: P
  71. module KsOfSion
    : x$ o0 A" E, n9 A, g$ r0 d( j
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false# Q9 }7 p: j5 Q- G4 g7 E% ^' x
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    , R% X. I3 u; X$ V2 M* l& Z* l8 t2 c
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    % l9 @& \' y$ K. l' z2 i
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量, T2 }, M! i6 q. A, C
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    % \& m' r6 W  A; S3 ?0 e6 t( b+ \: a
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧1 O& A, q3 i1 s1 m# m
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    : O$ G& M. d$ B$ g1 i6 p
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    7 w  m7 f8 p' _( G
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)* g, w) k* x) Q2 O* Y; k
  81. end2 R$ c, l# C5 j4 V; z( c+ S

  82. + g- c5 ]1 c. C- h# S+ e4 H  ^
  83. #==============================================================================* I* A# |( a& R! P/ b- q
  84. # ■ 用来显示路径点的类0 B) _, b7 _; X- b
  85. #==============================================================================
      r. z! x  B# F, u5 D4 d1 x7 F% c
  86. class Move_Sign  Game_Character' M+ K; `. ^0 H! g' E8 l: {% ]
  87.   #--------------------------------------------------------------------------; Q- {- {& p7 L% y! X* j7 H
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图) Q& b- W, V$ C1 x5 m% b" r
  89.   #--------------------------------------------------------------------------( E7 R! p  Y$ n" c# [+ K! O
  90.   def init_public_members. j% _% H, P3 j. W% U
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹9 L) i7 G& f8 j4 A; T
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    & h$ O% R, w" ^# ?1 J2 g
  93.     @move_speed      = 5        # ★ 踏步速度5 ?: p4 H' \4 T9 z
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    ! Y* o$ L- G( c# H( w- ]( O$ `1 P
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度% v2 R" ]: K4 [' V6 Z' E
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    5 h, v' p. G7 `9 t* ~  G
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    : V' c+ t' ~5 @  g" M  b
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)/ p* a% r3 q# O4 z  D3 ]% F- t

  99. 7 W* Z7 ?% a2 X

  100. + I% s. G0 W0 |% R6 E3 w/ M. d
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    ; v0 F1 ~0 \+ q( C7 _

  102. + _" I+ B8 e) z$ v8 k5 {& w

  103.   \" ~" C/ d: Q6 Y& U" X
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    / a. s! U' }" V6 x3 T' Y
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    0 p! g+ \) {* y0 n5 l) `  C
  106. ! L# _0 F2 N$ I' m
  107.       if $no_arrowpic_warn  S% ?( h' Z" b+ z  w+ H( g% b1 F
  108.         MouseShow_Cursor.call(1)
    ' B, h: V2 W3 `: s' Z' j) r
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png6 M& C* n2 q, i# G  E! q

  110. / C+ |7 h+ f0 G( E; @8 f- S
  111. “路径指示点”将使用游戏自带图片3 A- y/ n- e" q- k% e& o
  112. : ?0 v: L& a, K. S$ u! X7 \. i
  113. 该提示可以在脚本内关闭')0 `. e! @$ L  @% p2 ?+ {5 X$ b# g0 F
  114.         MouseShow_Cursor.call(0)
      `0 e& N1 v& `, S+ \1 L& U' R+ R
  115.         $no_arrowpic_warn = false
    . J# }! r' B5 F; r/ h/ E
  116.       end
    % ]% p. p; O; O
  117.       @character_name  = '!Flame'+ j7 V2 H( {- n/ Y2 l, J6 L4 L
  118.       @character_index = 6
    ; B9 H" }7 W$ i9 l( ^+ j( Y6 q" ?6 j% i

  119. 9 o- W" }* `4 s. v4 |$ l5 k) K
  120.     end3 E' H& e" G& G
  121.     @direction_fix = false  # 固定朝向6 f( i% @% r, a
  122.     @move_frequency = 6     # 移动频率! |! ?8 Y7 K; O6 t
  123.     @walk_anime = true      # 步行动画6 F  ]% H) j+ Z- ^3 y
  124.     @pattern = 1            # 图案3 h7 i9 V# k' S2 N6 i
  125.     @through = true         # 穿透
    8 O8 |- O- _8 x! V
  126.     @bush_depth = 0         # 草木深度, f  j$ q8 W7 K! T
  127.     @animation_id = 0       # 动画 ID
    % l, b/ Z6 T$ d( p% M3 w/ u
  128.     @balloon_id = 0         # 心情 ID$ B( }) `" @4 h% n, X
  129.     @transparent = true     # 透明- P' p% c4 J0 }# |8 n: o8 z' \
  130.     @id = 0$ V) h8 w( w, S  N, p9 Q" b
  131.     @x = 0
    2 }! n6 |1 s# g+ H. n6 U# y$ e
  132.     @y = 0
    & j1 |1 Q1 B5 F( _" F
  133.     @real_x = 0+ |4 ]9 Q' V! N8 j7 Z7 U) x
  134.     @real_y = 0
    # \0 _$ s4 F. W: {! U1 Q
  135.     @tile_id = 09 u% {& n  D) ^! r7 m
  136.   end. D  ]  u; x$ B
  137.   #--------------------------------------------------------------------------$ {5 E' G# L8 k7 Z& K0 d
  138.   # ● 定义实例变量- [9 ?  X$ F, L
  139.   #--------------------------------------------------------------------------
    3 l. Z: |) Z- v9 q
  140.   attr_accessor direction7 |/ g7 Z) v1 i
  141. end
    8 W5 c  }4 |0 Z

  142. - ^9 p, H! m: s& f1 g
  143. #==============================================================================
    " a7 i( M# l+ Q) D
  144. # ■ Module Mouse0 R( E& p4 r  r, g0 E; I, l" C
  145. #==============================================================================
    5 _9 c- s2 ~: K- ^3 V8 A! g
  146. module Mouse: h; ~! W" a" @# U5 w
  147.   #--------------------------------------------------------------------------) ?' R* B9 W' [8 ~
  148.   # ● API
    2 X8 h  @8 U* B; Y! H9 i: m
  149.   #--------------------------------------------------------------------------$ T. N/ j0 Q) W8 _7 S
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')% T6 R% ]/ O5 ^' q. }! s
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')6 S. W0 D% p: K3 \" s, M
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')1 m$ n' l  j- }1 E
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')' o6 k. k! O- {% B4 v
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    4 L1 N& h2 N; z
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    + U0 z5 O6 Q6 J" ?4 h5 @8 T  `, U
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    7 B+ U6 U  c& i* K4 _
  157.   Window_Hwnd       = Get_Active_Window.call
    ; d* c5 M8 g& n

  158. 8 u2 n! X% E. `6 _' }) A) `
  159. class  self
    $ b. K# q$ K, d
  160.   #--------------------------------------------------------------------------
    4 b3 a! \# t  }% ~8 n+ |6 T
  161.   # ● 初始化
    4 w1 Y. a; b- y/ ~5 [
  162.   #--------------------------------------------------------------------------$ q0 H5 U- {, r& [) S! d$ o7 @4 G( b
  163.   def init
    ; Q" L+ O; R9 K6 F! p& S/ O0 b( p
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    ; P1 x  K5 b6 u) K
  165.     @left_state = 0
    $ Y( A9 w$ \: k! h9 A
  166.     @right_state = 0
    ) u+ u7 r' r: {( {8 m+ Y
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    3 _8 C+ S/ ~) V/ W' U
  168.     @dk_count = 0 # 用于双击的判定
    8 d2 l4 r' A9 E3 A& ^+ I
  169.     @clicked = false! Z  x4 @$ J0 {. v$ z9 P5 ^
  170.     creat_mouse_sprite
    : p' {% \, {( q9 |: r
  171.     update/ l7 O, z" B9 A
  172.   end6 `$ \( B7 Z  U0 \
  173.   #--------------------------------------------------------------------------! y! u, V; C7 f# ~4 m1 p
  174.   # ● 鼠标指针精灵# p. o, \; B/ w* T  ]( Y
  175.   #--------------------------------------------------------------------------6 c8 t$ V; j, l1 {7 A6 v* i
  176. #~   def creat_mouse_sprite
    $ G# K# K3 @4 \1 ~
  177. #~     0 n7 e  e& W3 h
  178. #~       @mouse_sprite = Sprite.new
    ) S6 w' e- x5 a4 X1 O
  179. #~       panda = 2#rand(2)+1/ ?2 Q9 G1 l7 N" k1 a. X6 E( K: U

  180. 3 Q$ V/ y3 C- A% F
  181. #~      if panda = 1
    ; c) Q# B1 {. j5 H
  182. #~        if File.exist('GraphicsSystemCursor2.png')0 C: [8 W  ]& C' V- w
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')- c  i9 q* O# ]" e
  184. #~        end#with if File.exist
    6 M% G* i6 L$ ~, `6 S4 D& K
  185. #~   
    ! |  ^) Q' s4 _6 `9 k6 E, o, C
  186. #~     else if panda = 2 #with if panda=1) c) \+ }, I( p1 A2 H& @! y2 a
  187. #~      
    ( o, E6 f  {6 B# C! n/ \/ t
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    , d8 h; }" v) X6 I7 ^0 a: \: C; K9 t
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    . s  h% s+ D3 c+ Y* T7 P0 Y
  190. #~      end#with if File.exist: W8 f* y3 B( j# b" X7 g
  191. #~       ; h- \! _, v2 P- b% n
  192. #~     else #with if panda=1* Z4 P5 T  I6 q
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    % E% P$ o$ N4 n, k) s
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),. n* F( l) s2 H/ X/ ^( [  o; o0 A
  195. #~       Rect.new(5  24, 24  24, 24, 24))' L: b& a+ Z( f- a
  196. #~     end#with if panda=1  c7 O3 a( \! W% V3 Q
  197. #~     
    2 Q+ `4 `7 F9 Y6 u, v; e4 J5 F3 D- X
  198. #~     #with def
    8 N, g2 J; N6 {1 E2 s& Q3 F9 |
  199. #~   end- N5 g, Y% t2 v& H' _' k- d
  200. def creat_mouse_sprite
    ( o, I5 \: H1 r5 W, J
  201.     @mouse_sprite = Sprite.new0 }& q  ]  n/ T
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    : d8 T6 X+ R* O, d6 {0 q
  203.     @mouse_sprite.z = 9999
    1 |6 l! U0 _- R" I
  204.     Show_Cursor.call(0)% J6 x  H1 A+ X) n
  205. end
    5 I& ]7 C% C* T. r' ^
  206. 0 ~( m& Q  x- e; w
  207.   #--------------------------------------------------------------------------6 `8 ~4 }) {  L( c  M) [
  208.   # ● 更新
    : T, s3 X" R) Q# {" l* n) W' U
  209.   #--------------------------------------------------------------------------
    ; H0 b0 _* W1 R& M; c- c+ V. E
  210.   def update) V3 b7 d: M6 H' B
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    ' U, {2 `1 u. z  L
  212.     left_state  = Get_Key_State.call(0x01)1 Y/ R8 T$ q2 _: I
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    / Q# k- a( t* f" `. C3 p& a
  214.     right_state = Get_Key_State.call(0x02)
    * [5 M" H% }7 u% }
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0; K5 x1 j5 [" A) Z) f- z% V
  216.     update_double_click
    6 t9 o3 }1 W! c" T0 \) G! L3 x
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1) a) f8 f* [4 b4 s/ @
  218.   end3 `$ O5 R) I6 @# Z0 E
  219.   #--------------------------------------------------------------------------$ T+ [. J# M& ?
  220.   # ● 获取鼠标坐标
    $ w2 e8 f4 u& c. ]- }+ g+ d
  221.   #--------------------------------------------------------------------------
    ) ?; s. [+ |8 V0 M" U6 t0 K8 {! |
  222.   def get_mouse_pos
    # H, q- O6 f* c8 h8 R
  223.     arg = [0, 0].pack('ll')
    , y4 ^. Q+ o! o9 |. A
  224.     Get_Cursor_Pos.call(arg)8 ^# c0 Y" k0 \3 U7 d0 Y+ i
  225.     Screen_To_Client.call(Window_Hwnd, arg), B! A/ l6 `* v% i# H
  226.     x, y = arg.unpack('ll')9 n1 D4 J' z& D. l( e  o8 `  _
  227.     return x, y
    $ X; |3 n$ k0 {) r) M( X
  228.   end% A* a" n3 v9 j" r
  229.   #--------------------------------------------------------------------------3 }: |6 I' U7 ~  c
  230.   # ● 将鼠标固定在屏幕内. m( F9 n4 x$ @! D+ h
  231.   #--------------------------------------------------------------------------
    0 z5 \1 [0 c5 S9 f) ?0 K
  232.   def lock_mouse_in_screen
    & z4 A5 ?8 T9 x* C+ K% k: F
  233.     arg = [0, 0].pack('ll')
    1 u2 r) L+ o4 i
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    9 `7 z* x$ s% @* J* G' V  c( k
  235.     x, y  = arg.unpack('ll')! h1 A/ S, Y! v. r6 i# r4 l
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    $ n2 j  M) P, t- }4 h7 U
  237.   end! P* |9 _* n' Q) E* i
  238.   #--------------------------------------------------------------------------
    , ~9 a3 u* G- m
  239.   # ● 解除鼠标固定' c* g' i/ g" K2 H
  240.   #--------------------------------------------------------------------------3 s/ C% a9 v5 Z/ h9 P, F0 _8 c3 ]
  241.   def unlock_mouse_in_screen
    : X7 j- b6 G8 Z
  242.     Clip_Cursor.call(0)1 x, J6 i+ H7 h6 z& ~! _
  243.   end3 l0 n# q7 W; N" q8 o4 E7 [
  244.   #--------------------------------------------------------------------------
    6 Z( F. R2 f2 e8 y* C3 S  B6 }3 }
  245.   # ● 鼠标双击判定' u+ m0 A( b3 X( z
  246.   #--------------------------------------------------------------------------4 J4 u/ i& ~) e; ^! d
  247.   def update_double_click( ^! d+ E$ G" [  }( n7 v/ W
  248.     @clicked = true if @left_state == 1& A" z: |; o, r- W! z: f
  249.     if @dk_count  0 && @left_state == 1
    ! A' ~6 C2 I. J  X9 u4 L
  250.       @dk_count = 0; @clicked = false
    9 @; c0 J5 n- p2 O8 W
  251.       return @double_click = true
    - ~& H5 b9 L  a: ], I
  252.     elsif @clicked
    . l9 n  f- a$ o# T* C
  253.       if @dk_count  KsOfSionDbclick_Frame
    # v5 Q" H7 ?- `9 r
  254.         @dk_count += 15 }9 p6 b. i  D0 A' O7 Q' Q# D
  255.       else
    5 p6 F+ F# w& o  e
  256.         @dk_count = 0; @clicked = false; q( {- G  x4 b& U3 j* i
  257.       end
    $ x' U+ ^/ s1 t- K9 h5 C; A  n
  258.     end
    # v, E3 w0 R0 N& x. N8 k+ x
  259.     @double_click = false
    # Z6 R6 R2 O) r& N
  260.   end
    6 f7 {9 J) S7 ~- H
  261.   #--------------------------------------------------------------------------
    : Y/ d: D; D" |$ A+ M; ^
  262.   # ● 按键被按下就返回true
    7 M4 |& M2 v* ?" H
  263.   #--------------------------------------------------------------------------1 I5 A, E! _; m6 z3 C$ s
  264.   def press(button)
    , F1 R! w7 U1 b5 O3 h3 S* B
  265.     case button
    - z' }7 ^$ _+ D# k" `" f2 B# |
  266.       when 0x01; return !@left_state.zero- K* U" n8 U& z
  267.       when 0x02; return !@right_state.zero
    0 \. n9 t$ G4 A) t! e, T
  268.     end2 w% u* C# G6 S/ @
  269.     return false! ?' R) B& I/ G* S" J# n
  270.   end# ]% E& ~' P/ e: u( u* u
  271.   #--------------------------------------------------------------------------: B  W* P  Y( o; F
  272.   # ● 按键刚被按下则返回true$ {4 P/ E( f% w  ^
  273.   #--------------------------------------------------------------------------$ }5 }$ h1 Y4 t+ ~6 n$ D" ~: u
  274.   def trigger(button)
    * x2 t$ r0 Q1 ^3 d
  275.     case button
    8 L  t) i/ m6 h& V
  276.       when 0x01; return @left_state == 1
    : D+ z6 x( s. U
  277.       when 0x02; return @right_state == 1
    % @6 b+ E' q) b) e' X
  278.     end
    ( j% W# U; L% g( }% V& U
  279.     return false0 Y( w" f; E; y9 ]1 {7 D9 B
  280.   end
    $ D* d9 g9 H! b  e1 |/ s" m+ C) X
  281.   #--------------------------------------------------------------------------
    ; U( z: |1 u5 K3 ?- n+ _' {5 P
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true  V! i7 H/ e9 T! \- \  J& J9 w  B
  283.   #--------------------------------------------------------------------------
    & y/ i5 S; a) r1 x7 J
  284.   def repeat(button)5 l- F6 f# Y6 j
  285.     case button
    * y$ R; w) `! v  T7 U5 A5 F
  286.       when 0x01; return @left_state == 1
    " X$ u  j  B/ R* q0 P. u+ w) F) S
  287.         (@left_state  22 && (@left_state % 6).zero)4 {  N8 ~! g) H
  288.       when 0x02; return @right_state == 1
    - j, m: Y& H# s6 S) o
  289.         (@right_state  22 && (@right_state % 6).zero)" c! `5 u- W( \7 X
  290.     end3 G8 Y: i& [0 P/ `8 R4 P0 E
  291.     return false
    4 C, s2 t. e7 b' r5 O! B$ N9 ?/ z$ B
  292.   end
    8 J  ^; e" ]+ n, ~6 M  F1 K; Z
  293.   #--------------------------------------------------------------------------
    8 W  v3 u# b# K
  294.   # ● 判断是否双击鼠标
    $ r, D7 K, V: `- O8 ^
  295.   #--------------------------------------------------------------------------
    7 x, p& `) U) ~) B6 y5 `
  296.   def double_click
    ; l" `/ D6 V, ?$ s5 O" v% k
  297.     @double_click
    , R! U8 h+ O/ o  k
  298.   end
    ' v. z3 {" c) h9 `
  299.   #--------------------------------------------------------------------------
    9 V) J7 {/ d. o# b$ d' F/ K
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)9 x% j1 y/ s( J3 A
  301.   #--------------------------------------------------------------------------; y. y* l9 _% a! w/ W8 p
  302.   def click_count
    2 w* c- I2 X0 Q4 ~1 G) u# H) V
  303.     @ck_count
    ) H( |# b5 X( @
  304.   end
    9 b3 t3 c& T) E0 o* W
  305.   #--------------------------------------------------------------------------
    4 H# q+ n/ A! C3 v# X6 h1 R+ t
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    : z$ l9 T3 l9 w6 F0 t4 t
  307.   #--------------------------------------------------------------------------
    1 B8 ^# a( y4 J
  308.   def left_state
    , m0 E) m0 @- s# r7 F
  309.     @left_state, B# z5 B- ^9 s* j* p
  310.   end$ M3 ]1 h4 A. ]1 v- ~# @' N1 [
  311.   #--------------------------------------------------------------------------  ^6 k7 f% p/ b0 ^# S7 L8 C
  312.   # ● 获取鼠标的x坐标
    8 v5 L. C& Z# ^; `$ y, v
  313.   #--------------------------------------------------------------------------) M/ B9 F. `, [7 Z( U9 I
  314.   def mouse_x& C3 n* l, A( ]# v
  315.     @mouse_sprite.x9 {, Z  v$ @2 @2 J9 c
  316.   end
    1 V+ ^2 T( P. w4 K5 q* s) t
  317.   #--------------------------------------------------------------------------8 I! r" }7 i/ y3 S( T
  318.   # ● 获取鼠标的y坐标3 E  g: F) X' T, H
  319.   #--------------------------------------------------------------------------
    4 x" k; S" `. I& i- O" C; |$ N
  320.   def mouse_y* l! T( c9 T4 v  O# i# {
  321.     @mouse_sprite.y# S+ `4 m5 g$ }8 I
  322.   end* {7 N/ O" R- ~+ \( b% Y( r
  323.   #--------------------------------------------------------------------------
    " n) }- M% g" q; ]0 j$ w+ Z
  324.   # ● 设置鼠标坐标
    , Z; \' k1 w" Z+ ]% Q
  325.   #--------------------------------------------------------------------------% ?  \0 R! U8 Y  V" N: z4 b! C9 X  g0 ?
  326.   def set_mouse_pos(new_x, new_y)
    ( _! p9 \- G9 [: W/ p, u# Q
  327.     arg = [0, 0].pack('ll')
    , I" o) c5 f0 V
  328.     Screen_To_Client.call(Window_Hwnd, arg): P/ W5 Y* _% L) Y2 |
  329.     x, y  = arg.unpack('ll')
    ( ^+ i3 a" J7 b5 B7 Z# Z  k
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)% k, f9 m' t$ H5 G7 H) |% j# R
  331.   end9 d5 X0 t4 [4 B+ a& ?9 ?; L
  332. end #end of class  self : M4 o) ^2 O# b6 }
  333. 1 @1 F' y1 D1 J; n( B9 [
  334. end
    9 f) p9 T2 D6 i' J+ U  ]" V
  335. 4 {8 o2 l9 w& _: H
  336. #==============================================================================
    % H  E  m9 {* H  X7 Z
  337. # ■ SceneManager
    . ^+ P" @, Q4 G- \, I
  338. #==============================================================================+ c2 _; F' t$ U/ u. i+ U
  339. class  SceneManager
    2 g; @" z9 D: A
  340.   #--------------------------------------------------------------------------
    8 ?. l+ X* K' v- Y" H$ u
  341.   # ● alias* j% ~6 A4 i8 |. s
  342.   #--------------------------------------------------------------------------! \" x# W. w& t4 M" w* e& l
  343.   unless self.method_defined(sion_mouse_run)3 e0 o, E) c) J& M5 H4 M/ B- ^5 j
  344.     alias_method sion_mouse_run, run
    ! y5 v( c( h; t( i4 c5 V
  345.     alias_method sion_mouse_call, call
    / q% \* j" S& i) l8 ?9 {
  346.     alias_method sion_mouse_return, return7 n$ J" k" J  d. x; e% O+ J" m0 G
  347.   end
    6 m! s# n* _8 |3 A
  348.   #--------------------------------------------------------------------------" p/ T$ E& J$ w- ^
  349.   # ● 运行' G; X- M/ z* Y2 c$ r4 q( c. ]
  350.   #--------------------------------------------------------------------------
      P8 j" h& A0 W+ a3 T' ~" x
  351.   def run
    - M+ N+ D) Z, q0 ^$ S4 A7 i  D2 Z* A
  352.     Mouse.init2 J  k( ^+ B, I8 V5 x6 t
  353.     sion_mouse_run! b  U% y+ s1 w. j; ]; E8 L0 h
  354.   end
    * z+ K* c* r3 g
  355.   #--------------------------------------------------------------------------
    8 }, e' Z' {. O! I/ y2 R
  356.   # ● 切换2 u5 W- i% W. b3 N& p0 k6 ?- R
  357.   #--------------------------------------------------------------------------
    * i& J$ K; ^& E# n2 `
  358.   def call(scene_class)
    0 v( \  @7 ^1 B# q3 l! K
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)) L/ k( O- i" {) ~
  360.     sion_mouse_call(scene_class)! O5 }* J  x- b9 h# J2 `
  361.   end
    5 G6 K  m* M' K5 U# H" m
  362.   #--------------------------------------------------------------------------
    ) Q7 @( h4 u/ A( J( M) a
  363.   # ● 返回到上一个场景5 c# d! _! E. x+ y& F2 H6 Q
  364.   #--------------------------------------------------------------------------
    3 H0 [. G9 L! S7 v5 C
  365.   def return( e4 w  b3 s8 ?: U
  366.     sion_mouse_return) m& o, {# ]; a  ]$ P
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&: z. X% T$ L- d- H2 _0 V" p* C1 H
  368.       @scene.instance_of(Scene_Map)1 ?. C3 X8 @+ Q" ^4 |  r3 t) L
  369.   end) C0 U- v, d, F! {
  370. end2 y5 ^$ a; @4 J8 `, R

  371. " h1 E- }4 }) K2 `; N* ]" p, M
  372. #==============================================================================; p0 c: r' R' u5 q9 F7 Y
  373. # ■ Module Input( V8 t5 {+ ^2 }* p+ H
  374. #==============================================================================$ ~1 e- Q! g, B( e* A. G0 U) ]' r
  375. class  Input
    ; k) B. b8 ?& l
  376.   #--------------------------------------------------------------------------
    / W& t! _) M, v' O. i3 B4 g* T3 P" A+ K
  377.   # ● alias: q, N0 ?: A; u& o2 [' Y+ u& a
  378.   #--------------------------------------------------------------------------
    7 ^! ^& d4 r! E( H8 M: m
  379.   unless self.method_defined(sion_mouse_update)
    ) H  q2 b4 F- x) M) B# e3 j- f; D
  380.     alias_method sion_mouse_update,   update
    8 A) z' w" F/ g3 V/ M6 [
  381.     alias_method sion_mouse_press,   press
    % |5 E- i% B$ K; p, s
  382.     alias_method sion_mouse_trigger, trigger
    - S/ _1 C# u2 E( l
  383.     alias_method sion_mouse_repeat,  repeat
    - i2 |' i5 U; K6 v) H8 Y% ~
  384.   end
    5 D" s0 \4 a) s4 }6 d3 Q6 j/ Y
  385.   #--------------------------------------------------------------------------0 ~7 `8 v. |( ^& |0 h
  386.   # ● 更新鼠标! M$ P( C) `6 B3 I! E; u% ^
  387.   #--------------------------------------------------------------------------
    : v" Q- T' T! h3 p6 D
  388.   def update
      _$ c( l) J, F; d1 i
  389.     Mouse.update  E1 T! |" l9 ?" u1 }# V
  390.     sion_mouse_update/ Z5 G9 L! N; y
  391.   end- }1 {. _' e& E
  392.   #--------------------------------------------------------------------------
    . c( ]3 ^! E& f5 a7 c
  393.   # ● 按键被按下就返回true
    2 d' W/ ~6 A2 J& p
  394.   #--------------------------------------------------------------------------1 i5 t6 ^: h; i8 T. u' H2 _
  395.   def press(key)8 X/ y8 O& M0 ^3 j- h
  396.     return true if sion_mouse_press(key)
    , c5 h' \8 X" y' l9 {( O, U5 _, D
  397.     return Mouse.press(0x01) if key == C" q7 v; d& D' _5 {
  398.     return Mouse.press(0x02) if key == B5 S  B/ r" ^/ \% d! g+ Q
  399.     return false% a7 R* @- B% n; U  z
  400.   end9 `2 N) S* n6 s4 g- x
  401.   #--------------------------------------------------------------------------$ h% {$ ?2 V3 P  f
  402.   # ● 按键刚被按下则返回true" R9 C% s% V6 M% J1 e7 B
  403.   #--------------------------------------------------------------------------! ~6 x' E+ R- i( J
  404.   def trigger(key)
    1 A$ p% A3 U# W6 B2 }8 ^' s
  405.     return true if sion_mouse_trigger(key)
    ( w' ]/ C8 ]2 Q3 G' h
  406.     return Mouse.trigger(0x01) if key == C
    - s! E1 L& F* }$ I" n
  407.     return Mouse.trigger(0x02) if key == B3 V. ?9 Z$ M4 W! [4 M& C; x
  408.     return false
    & g3 f  N, ?# z* B; ?; |
  409.   end
    * h2 }$ M2 J2 p5 G2 b+ p( U& Z
  410.   #--------------------------------------------------------------------------0 O5 i: ^- \) k
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true! e$ E5 ^# E- f4 |1 B0 q
  412.   #--------------------------------------------------------------------------  Q0 o% \% n" q' q$ t8 f" H
  413.   def repeat(key)% H2 k: P0 D0 ^$ t; m
  414.     return true if sion_mouse_repeat(key)
    + U1 q: s' U3 a( l, W2 j; E
  415.     return Mouse.repeat(0x01) if key == C  `4 h8 K. t: }9 W$ j
  416.     return Mouse.repeat(0x02) if key == B
    ! r+ b- E7 }$ D* J3 }( B3 O
  417.     return false; ]* D, A* e3 ?
  418.   end/ n4 v6 L+ ~8 \1 {; ~2 W
  419. end
    ( u1 y) R& D( B: @* R: o
  420. ; h8 q  [  j5 \+ j2 v

  421. " Y0 D& D7 v2 z7 ^9 I
  422. #==============================================================================( M, s1 b) ~+ i6 S1 h, ~0 ^
  423. # ■ Window_Selectable
    * N2 o- U8 J& q9 B' j: g
  424. #------------------------------------------------------------------------------
    ' \  j+ Y& j( ~9 u
  425. #  拥有光标移动、滚动功能的窗口
    , }6 c$ X$ m- p7 {) p
  426. #==============================================================================1 J* X. E: I* ^: a* Z( _9 U
  427. class Window_Selectable: t- h! \  R  h; O1 ?
  428.   #--------------------------------------------------------------------------
    / A" Q2 Z: Z& F8 [! p0 Y  n
  429.   # ● 初始化
    ) }2 p/ }6 p8 P+ d7 y$ h
  430.   #--------------------------------------------------------------------------
    " o5 h' X. u7 _7 @
  431.   alias sion_mouse_initialize initialize- h: T! i4 z' q3 o
  432.   def initialize(x, y, width, height): Z5 |" G/ A8 {8 S
  433.     sion_mouse_initialize(x, y, width, height)
    2 ?& h4 {+ z% D$ {
  434.     @move_state = 0, d" G( `. Y; A( G0 J" _: S( v
  435.   end
    3 W" O/ K2 Z2 A' ]6 _# c- m, R" i
  436.   #--------------------------------------------------------------------------# y- S# V1 k6 |5 [. ^- f4 S
  437.   # ● 更新
    1 s, ^$ a8 m- y
  438.   #--------------------------------------------------------------------------5 v' }0 Z$ Y6 m" m# U1 ]. }* _
  439.   alias sion_mouse_update update9 J* P0 }0 k) n4 p6 ^8 {
  440.   def update
    ' l1 A" j% Z4 F! k" b1 l% j$ s6 X4 o
  441.     sion_mouse_update
    * ^% d3 H) l; I8 ]4 M
  442.     update_mouse_cursor
    ; d7 ]2 @! M9 n% w
  443.   end
    ' j; w' Q" o& |) X" U
  444.   #--------------------------------------------------------------------------8 \; C' K7 d$ h: c9 S
  445.   # ● 启动后设置鼠标到index位置
    , Z$ f* w9 O* J0 E
  446.   #--------------------------------------------------------------------------# r- `7 Z9 m& R( T& L* n( H- g! d
  447.   def activate
    * Q5 @8 y. T: q  x. O- c4 I
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos1 V+ ^$ _( D$ G+ f3 E) V  `
  449.     super
    * ?$ x; f# I1 i  r
  450.   end  a  K. l$ ]4 h2 F7 ]* w
  451.   #--------------------------------------------------------------------------5 u( K9 o, J/ j! f# c
  452.   # ● 更新鼠标和光标的位置: }  x+ A  Q( s' z2 j) r9 C
  453.   #--------------------------------------------------------------------------# Q, A8 d  s: \' }. _, s
  454.   def update_mouse_cursor" ]+ ~5 q1 o9 O
  455.     if active
    , x+ }, F  S+ v$ P; [& R
  456.       if @need_set_pos
    " K  X; N- K* f5 p
  457.         @need_set_pos = nil6 i3 e' L8 p% j' E0 Q
  458.         set_mouse_pos
    & h' V, x1 u# ~' E1 E
  459.       elsif cursor_movable0 R$ L/ O: Q: _; J$ Q+ a: e: P
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
    ; Y1 `+ `4 G6 \3 _8 a7 J7 P
  461.       end- M: ^6 G' V* {% B; j- [
  462.     end# E) m" z& {/ g2 ^  i4 R) M
  463.   end5 o  }- l$ Y  [
  464.   #--------------------------------------------------------------------------
    * W* Q6 t2 k2 q3 ^" p* w$ @/ n
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能$ ?. a. R3 g$ X
  466.   #--------------------------------------------------------------------------7 {3 @7 L2 T' M. k
  467.   def set_cursor
    + `; U1 [& }  @' c
  468.     mouse_row, mouse_col = mouse_window_area
    ' i7 a. z: G. R2 a( I
  469.     if    mouse_row == -1
    + n$ c6 b% K+ J( P" k: M; e& i' r
  470.       @move_state += 1 if need_scroll( X3 x  i; ]- W0 d9 q4 U# C
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand: X0 b8 c# i" @/ A7 c8 N; h
  472.     elsif mouse_row == -2
    " O8 q% v  _" b3 y, i+ g$ `% M
  473.       @move_state += 1 if need_scroll7 ]1 K1 }+ K, S& _
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    1 b4 T3 y, R! @/ ]. u( H
  475.     elsif mouse_col == -1
    2 W7 _- q$ k7 P3 x3 F
  476.       @move_state += 1 if need_scroll- C; b  b+ N8 j8 T- b2 E5 _
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    7 K4 a: e) n! u3 d  k
  478.     elsif mouse_col == -2+ r! X/ l# y( Z: T0 H/ p
  479.       @move_state += 1 if need_scroll% [/ ~+ ?& I8 f  u* _. b( H% W
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    $ x3 M" C* s2 G2 x2 ^: h
  481.     else
    ) U- O  U5 c7 F, L' [7 m; j
  482.       @move_state = 0
    3 O. S* r: u+ p. T. y
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    6 q! q& k& z* Y, _; j2 I$ y8 `- q4 u! Y
  484.       select(new_index) if new_index  item_max && new_index != @index2 l: o3 e' f' ]
  485.     end! u+ d0 [' S# Q
  486.   end
    # W/ f: z% E0 Z1 o& P# \) W
  487.   #--------------------------------------------------------------------------
    # H0 F% X6 H7 A7 a- M# O
  488.   # ● 判断鼠标位于菜单的第几行、第几列" j0 ]: v) ^$ M4 N8 R" Y
  489.   #--------------------------------------------------------------------------  ~* w3 z% a& y% g0 h0 S
  490.   def mouse_window_area5 f. N! x, s  K& H3 [
  491.     if viewport.nil # necessary!
    * i2 J. N& S+ ]! C& k- e
  492.       vp_x, vp_y = 0, 0
    ! n# |/ B. c& J  r7 b2 w7 ^
  493.     else/ p- v: s( u8 k8 y
  494.       vp_x = viewport.rect.x - viewport.ox" d8 P: D# B- C! c9 e7 ]
  495.       vp_y = viewport.rect.y - viewport.oy0 ~( B3 [6 H! M' }* B& {5 G
  496.     end
    ' {- K; h8 ?. e. M: q/ o
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    / H: T8 P" I' ]' [* S! `% z
  498.     item_x1 = vp_x + x + standard_padding ( ~/ r$ I; o! u; }
  499.     item_y1 = vp_y + y + standard_padding
    ' j: p: p( h5 ]6 M9 d
  500.     item_x2 = vp_x + x - standard_padding + width
    ) t% Z  Z2 S9 Z# q4 ]
  501.     item_y2 = vp_y + y - standard_padding + height& Q1 e/ T2 C  f% i7 s7 I
  502.     if mouse_x  item_x1
    ; Y0 g4 C6 D2 S0 T
  503.       mouse_col = -13 t5 G' ?0 U0 B+ \) h3 b: e
  504.     elsif mouse_x  item_x2
    2 R( w: B( |3 r! {  ]- A) S
  505.       mouse_col = -2
    " S, \* J9 \- V3 y9 p" M
  506.     else" {: k% }: t" @
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    5 ]. e5 V' w) G1 d5 t2 _
  508.     end) w/ p6 d+ Z8 q& U
  509.     if mouse_y  item_y1. n2 D: _+ Z* |2 r& G
  510.       mouse_row = -1
    5 P3 G  ~. V/ o9 `
  511.     elsif mouse_y  item_y2
      G& @' d9 M0 i$ `- Q; N) M
  512.       mouse_row = -26 K" V# h5 e2 b/ ]
  513.     else
    2 l9 M0 V1 D. l8 K1 ~- p
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)6 O: X+ n- v) R6 q5 F1 B' ]8 k
  515.     end
    3 \  j( [8 k. r; o$ v
  516.     return mouse_row, mouse_col5 C# y% t9 s: j" M5 I
  517.   end, H4 z$ ~) U: r
  518.   #--------------------------------------------------------------------------! k8 s- Y# V4 T2 K
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置& I" m8 p& H& T6 W1 U
  520.   #--------------------------------------------------------------------------" Y& u% c+ I6 F
  521.   def set_mouse_pos
    ; H& r( J7 i7 N
  522.     if viewport.nil # necessary!
    + U% m5 |0 D. ~
  523.       vp_x, vp_y = 0, 0; {; m- C+ C" \0 A* n" a* D
  524.     else
    4 e4 Q1 q8 {  Q9 E5 Q
  525.       vp_x = viewport.rect.x - viewport.ox! T5 f, `5 X4 l; j& J& _
  526.       vp_y = viewport.rect.y - viewport.oy
    # Z/ _  g* G' e) E8 h3 `1 q9 |
  527.     end
      d8 f. n, }2 q; p
  528.     item_x1 = vp_x + x + standard_padding
    / w* n  V; N5 ]) m$ n  r
  529.     item_y1 = vp_y + y + standard_padding
    ' C8 y# @# G3 ~
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    9 u+ R" E3 W) m5 u
  531.     row = get_index  col_max - top_row% Z1 U) M) |' C' m& w# u
  532.     col = get_index % col_max
    - J$ S% C& h* }$ [3 b5 m" }
  533.     new_x = item_x1 + item_width  (col + 0.5)
    7 N  V+ N% r( o( L
  534.     new_y = item_y1 + item_height  (row + 0.5)# W+ G! q, C" x
  535.     Mouse.set_mouse_pos(new_x, new_y)
    # H7 C! b. j2 T* U
  536.   end
    : b" S1 `3 g; k2 S4 a# C
  537.   #--------------------------------------------------------------------------5 }5 k* [9 [$ Z
  538.   # ● 判断菜单是否需要卷动! N. x( }  r5 S$ ^8 j( c& E
  539.   #--------------------------------------------------------------------------; ~, w& P- ^/ i$ P+ f
  540.   def need_scroll9 d+ K; V4 ]2 z. x) V
  541.     item_max  col_max  page_row_max3 m# [, C7 G: ~7 O
  542.   end
    # y$ z8 H8 I0 o  h4 }
  543.   #--------------------------------------------------------------------------- E* l- ?5 G/ U& V
  544.   # ● 判断是否为水平卷动菜单( e$ V7 o. J$ }% K8 Z- q
  545.   #--------------------------------------------------------------------------
    # c1 G; ?/ L# d" Y. q8 h
  546.   def is_horzcommand
    + R! V1 l% @+ E& Z
  547.     return false
    6 x/ O# x) q' `& k
  548.   end; [# v/ e' a& l/ C, U1 J& V1 m
  549. end3 a5 O( D: v% c+ W8 ]+ `' H

  550.   T; Y0 @6 |3 {# r
  551. class Window_HorzCommand) _4 ~  |3 k; t; q' o9 G/ u
  552.   #--------------------------------------------------------------------------
    + p+ |% n4 E; \2 x0 T* o- k
  553.   # ● 判断是否为水平卷动菜单# n# m7 q. Z( a
  554.   #--------------------------------------------------------------------------
    , Y; d0 a( E; ^- ?
  555.   def is_horzcommand4 f7 y5 \6 [. d0 t1 @5 j, N2 d) v
  556.     return true
    ; H9 U- L2 n- r) @
  557.   end/ f; V! Z6 K' _, W9 B
  558. end2 \4 y0 r, H1 W. x5 @2 ~

  559. + G! b5 j* t0 V5 I
  560. #==============================================================================* l  v, A( g; `: s/ B, w; v
  561. # ■ Window_NameInput$ @2 n9 o! ~3 u- b, r
  562. #------------------------------------------------------------------------------1 Y8 ^* B' \  v& C
  563. #  名字输入画面中,选择文字的窗口。" U2 R9 f$ w# p: X% X: c) F
  564. #==============================================================================
    " C7 _" ?6 ~( _$ E8 o
  565. class Window_NameInput
    ( d0 o. g' m; H7 O/ [% w* L
  566.   #--------------------------------------------------------------------------1 I" ~" Z/ f3 V6 m3 M" H4 w  B
  567.   # ● 设置列数
    * k+ s: s! d/ s$ ^
  568.   #--------------------------------------------------------------------------* c: s, V7 [) w' V: z% D5 i
  569.   def col_max
    1 C  }( I+ O9 C1 r; T9 F+ ]
  570.     return 10- C5 K5 g0 M2 Q
  571.   end
    # w9 s' Q6 s  t2 ~' z
  572.   #--------------------------------------------------------------------------7 p- s& c* [2 N  l
  573.   # ● 设置填充的Item个数
    ( _$ x% U) J, Q4 l9 ]6 o& n5 r
  574.   #--------------------------------------------------------------------------* L* ]% D7 J- J3 e7 i9 c6 {
  575.   def item_max  j! j" D6 `; o6 Y
  576.     return 90
      `- t/ m( U0 S& b. {
  577.   end
    - L: C- b8 X- J- l# f
  578.   #--------------------------------------------------------------------------
    - U2 J. `" Q- y9 r
  579.   # ● 设置填充的Item个数
    * v+ y3 s3 c) a) x1 m* K
  580.   #--------------------------------------------------------------------------- S7 g: M7 Y% e
  581.   def item_width
    2 `( `) |$ y6 G1 R7 `
  582.     return 32
    & D. i. y* J) G: S% Y
  583.   end0 z& S  A7 S! }1 r# J5 B0 N3 `
  584.   #--------------------------------------------------------------------------5 m- }+ l5 [) E4 }) s
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    : F& o# v+ T3 B. y# }
  586.   #--------------------------------------------------------------------------6 I4 `0 Y1 x0 G8 x  ]( F
  587.   def mouse_window_area
    % |" x3 ?7 g" A
  588.     if viewport.nil+ X$ b! m9 ^' k' p( _, J' n
  589.       vp_x, vp_y = 0, 01 w& L' h- s, I6 a7 W" P6 p
  590.     else7 y- S: Z2 m9 _9 O' y+ N+ y
  591.       vp_x = viewport.rect.x - viewport.ox
    # j# l4 @) I4 p$ q1 X
  592.       vp_y = viewport.rect.y - viewport.oy
    " U, Z1 E% U0 U3 k
  593.     end% s/ M' S1 Z7 i3 G
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    9 f2 W! D# q# Y, d* Q5 I! z& c
  595.     item_x1 = vp_x + x + standard_padding # H& X  N5 o4 y, U9 J8 m0 U
  596.     item_y1 = vp_y + y + standard_padding
    ) [4 Y! ]: L' x$ G
  597.     item_x2 = vp_x + x - standard_padding + width
    & z. C9 s2 _) z$ r5 j
  598.     item_y2 = vp_y + y - standard_padding + height9 b/ |4 a6 j- S9 [8 e
  599.     if mouse_x  item_x1
    ' b- B6 G% I5 b0 Q; R* }! h
  600.       mouse_col = -1  e8 e* D. z  x
  601.     elsif mouse_x  item_x2
    3 ^3 D2 Z" d& s" o! r# j2 g) W4 V, Q
  602.       mouse_col = -28 O6 n) T  U5 u- x0 v4 X
  603.     elsif mouse_x  item_x1 + 160
    " _6 E; T! D( p' \; n
  604.       mouse_col = (mouse_x - item_x1)32
    1 r% E- c6 @9 F. |2 _/ ]) e! D
  605.     elsif mouse_x  item_x2 - 1603 Q5 w, \) P* E9 H, h
  606.       mouse_col = 9 - (item_x2 - mouse_x)32$ r& ~6 `: t# v5 S9 \( m0 k
  607.     else8 ?. A9 e, B% j) q/ M
  608.       mouse_col = mouse_x  x + width2  5  4
    5 U3 p# I. b; P, U/ Z5 \! e& {
  609.     end
    0 P: a% S% s3 R4 D5 J: |7 p
  610.     if mouse_y  item_y1% c1 O4 c6 c2 W8 T) w2 ^0 X* f
  611.       mouse_row = -1
    & F; ]; f& j1 _
  612.     elsif mouse_y  item_y2
    / R2 D  a7 k$ f  H" q
  613.       mouse_row = -2
    ; x% ?, ]/ E0 V; ?
  614.     else2 c: r" F9 U) Q1 n1 W
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    ! j& p2 e; l" v
  616.     end
    3 y# m3 {( |! M( w8 b
  617.     return mouse_row, mouse_col
      j  S) y/ V6 r2 |
  618.   end
    & k+ c  H4 H( Q
  619.   #--------------------------------------------------------------------------5 _2 D/ q, d. X
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    3 d3 p, Y$ V; K/ C
  621.   #--------------------------------------------------------------------------' ?7 P  W6 F/ }# j
  622.   def set_mouse_pos' L5 k5 ~7 _& S3 y8 e
  623.     if viewport.nil # necessary!
    . _1 j/ `4 O  I  {+ z
  624.       vp_x, vp_y = 0, 0
    0 T. H* M( t) \; n. F) y& V% F
  625.     else5 {( R: V+ t5 t
  626.       vp_x = viewport.rect.x - viewport.ox
    $ X0 c! k1 |% e# t3 D- `7 D
  627.       vp_y = viewport.rect.y - viewport.oy
    3 t  M3 |2 C" P% P; }
  628.     end
    2 s9 A% h0 \$ ~0 }9 ^9 R- ^
  629.     item_x1 = vp_x + x + standard_padding
    3 j- k( _5 K% a; s) R6 T
  630.     item_y1 = vp_y + y + standard_padding
    6 g' l: T& K# N! c2 d3 i0 W
  631.     get_index = @index  0  0  @index 9 V( j* a& J% h: E" X, G8 [3 a
  632.     row = get_index  col_max - top_row2 n: z& W) S6 [% \+ l
  633.     col = get_index % col_max
    4 Q" _3 m. y2 A# o: K5 c
  634.     new_x = item_x1 + item_width  (col + 0.5)
    6 G9 i2 K& y" f2 ]7 {  P* a$ n
  635.     new_y = item_y1 + item_height  (row + 0.5)
    9 I; v5 ?& i7 f/ T$ C
  636.     new_x += 14 if col  4
    8 f' j/ O$ L8 Y8 t7 v
  637.     Mouse.set_mouse_pos(new_x, new_y)
    ; |  f  L- ]* l7 [, q: d# w
  638.   end' V2 t) I' Y; v+ z! W" O6 }
  639. end
    , V- t/ i, X0 u0 k' I8 ~& K

  640. 9 a  F) N- @% A) O) y7 y% m
  641. #==============================================================================
    # j, Y/ R+ Q9 p! I4 j% w
  642. # ■ Window_NumberInput% c5 r  F3 V' C6 V# ]6 V, Y# G
  643. #------------------------------------------------------------------------------
    9 Z& V7 V/ V$ c  [" O/ e+ Z) ^
  644. #  重写了数值输入的方法以适应鼠标
    8 ~) ]3 k  s- H# d. K, Q, w0 g/ [3 u
  645. #==============================================================================
    - S0 z1 `* W; S1 }, ?( i4 D
  646. class Window_NumberInput  Window_Base
    % v& H8 H, p; c( j  ~+ M
  647.   #--------------------------------------------------------------------------
    $ S1 w; I# h5 B- H/ d  c4 W  ]
  648.   # ● 定义实例变量
    1 s! X5 P1 G- e+ ?. X8 Y
  649.   #--------------------------------------------------------------------------
    0 t# {4 Y2 I$ X0 }
  650.   attr_reader extra_window+ h2 q/ v, Y+ C% I. ], }
  651.   #--------------------------------------------------------------------------5 d) y. }: a7 D7 x2 \. f1 f4 l
  652.   # ● 初始化, |) k: W; W) I) B
  653.   #--------------------------------------------------------------------------- F5 K) M6 }) b, S) D& I
  654.   alias sion_mouse_initialize initialize: X9 r  M4 W- ^8 A7 \
  655.   def initialize(arg)6 r% i: a: Z* W% u2 Y0 j+ A6 \
  656.     sion_mouse_initialize(arg)" L) Q! \2 O, _2 E
  657.     create_extra_window/ l" Z( M3 ^6 e( s
  658.   end
    , X$ C" i  t$ G6 c% X: _+ h: {
  659.   #--------------------------------------------------------------------------
    5 }4 u4 g6 E' K- S3 c( ?6 ~
  660.   # ● 启动- L! K- p2 W8 ~# ~2 }% A( Y
  661.   #--------------------------------------------------------------------------
    / S' e' Q. K! T3 X3 f& ^
  662.   alias sion_mouse_start start
    ! \+ Z, u$ P+ h: y+ e$ |6 L0 l
  663.   def start* o' R- Y' d- `9 I/ |! j% W
  664.     sion_mouse_start( M' t6 t+ a8 ~0 J. _. O
  665.     deactivate+ E7 C, P7 f$ Y# W, G
  666.     extra_start: ^3 k6 |; d4 A  g) I7 V) _0 H: v
  667.   end
    / s/ D" @% q0 |& T
  668.   #--------------------------------------------------------------------------
    / K' x. F2 I5 r0 ~: S+ J
  669.   # ● 创建新的数值输入窗口
    3 ^3 s0 h. V1 `7 B& z7 A
  670.   #--------------------------------------------------------------------------( ?0 [9 o* D9 ?4 a/ j- I) L8 B# K
  671.   def create_extra_window1 Y2 R+ q; o" D* c* R. J; V5 t
  672.     @extra_window = Window_NumberInput_Ex.new
    + n. m3 c3 {; \5 x5 z* G6 W
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2  r# F$ j3 c( t. b+ R
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    2 {* L2 G# _/ x3 _3 D* E7 l: O
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    6 \0 I0 I- \3 ?4 d9 Q
  676.     @extra_window.close_proc   = Proc.new { close }6 F  y3 P% `$ w
  677.     @extra_window.refresh_proc = Proc.new { refresh }6 l8 K( X5 J2 l$ k2 I1 J& G' X/ z
  678.   end
    3 `/ F# X  n7 q9 v7 a% q
  679.   #--------------------------------------------------------------------------2 O5 D& |; M/ {3 M/ @. ?4 A
  680.   # ● 激活新窗口9 u1 V2 u3 k; V+ D$ J
  681.   #--------------------------------------------------------------------------
    ! M9 k: U* J1 V8 e
  682.   def extra_start% Q0 H6 @- h+ [$ _, c
  683.     case $game_message.position9 e8 i, j1 i& H. t
  684.       when 0; @extra_window.y = y + height + 4
    6 ^- D  m: J0 Z" _7 D
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    * J) q$ t, Z6 i- D9 ?! W+ T
  686.       when 2; @extra_window.y = y - @extra_window.height - 4, r  w- X: K' }2 X( D
  687.       else  ; @extra_window.y = 8
    . P0 ?7 {; X) l3 N
  688.     end5 e2 y, V; n" G
  689.     @extra_window.variable_id = $game_message.num_input_variable_id6 J8 q9 b, `4 v' k1 l6 r
  690.     @extra_window.digits_max  = @digits_max
    # C/ t: R" r/ _
  691.     @extra_window.number      = @number
    1 e- I% ~$ K- }
  692.     @extra_window.open
    & z, K, ]! Y) M- p, N
  693.     @extra_window.activate
    $ q7 Z  l5 x+ `' i# ]! a: L
  694.   end* G1 R2 ^8 v/ ?5 r
  695.   #--------------------------------------------------------------------------4 c0 U8 V. q1 j& d3 |
  696.   # ● 更新
    0 I3 K9 o. h3 _3 Q( L5 N
  697.   #--------------------------------------------------------------------------: Z: S' ^7 L- Q
  698.   def update7 F( x, V: n7 e7 U' `
  699.     super
    ) s3 Y# q9 j( s0 s/ Q9 r
  700.     @extra_window.update
    4 f% k! n$ x' S3 |& f) }( Q# f- R
  701.     update_cursor
    ' n8 ~: n! F) {
  702.   end# |/ T- j# p) R3 o3 ?) T; M  M
  703.   #--------------------------------------------------------------------------
    + d' v) t* W" a$ y& i
  704.   # ● 关闭窗口
    , }% j" J- |" _: |5 M2 m9 J
  705.   #--------------------------------------------------------------------------+ c, t  o$ z  c9 {; L3 V( K. Y% _
  706.   def close
    ( e+ I4 h1 }2 ]: Z
  707.     super
    + p" S* Q* Z* @, r9 d9 b
  708.     @extra_window.close* Y& r) T6 q: u# Z$ K
  709.     @extra_window.deactivate. [4 B# Y  A" s3 h3 b' T0 \
  710.   end
    ; X0 j$ L; ]. ~! ^0 w% T
  711. end
    $ b) z2 q* w8 ~2 Y7 I

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

  2145. . |7 s$ R! J" P0 z% x5 [3 C4 I
  2146. #==============================================================================! L8 T6 z% Q+ K" c
  2147. # ■ Game_Map3 m9 ]! y) u( _' I
  2148. #------------------------------------------------------------------------------
    & v  e) a/ z3 y
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。7 ^) B& t1 R$ w9 n
  2150. #   本类的实例请参考 $game_map 。6 T4 U0 e* M5 v
  2151. #==============================================================================
    % a& k/ A" Z& |8 Q: z# U
  2152. class Game_Map- r6 B1 ?* c, z8 t9 ?0 h7 B
  2153.   #--------------------------------------------------------------------------
    ; z1 ~; a! }! P$ I- _
  2154.   # ● 定义实例变量
    ( g$ V, J. f8 `' c$ V* L+ ?; p
  2155.   #--------------------------------------------------------------------------
      |8 n$ `/ s- f- K) ~
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
      Z, j* S9 c* I. L8 t( K
  2157.   attr_reader mouse_map_y # 同上
    & Z' q$ W8 c& u0 W1 O, x
  2158.   #--------------------------------------------------------------------------+ h5 O, ?. l: v9 B& I! Q2 W
  2159.   # ● 初始化对象: P$ L0 t+ S4 F$ V3 S% _! T
  2160.   #--------------------------------------------------------------------------
      a9 Z5 _% S* M: u
  2161.   alias sion_mouse_initialize initialize
    5 N8 j: ?1 A; b8 U/ a
  2162.   def initialize' C" H! W7 l" W5 S; [( {
  2163.     sion_mouse_initialize2 E: t5 t# ^. ^' |' q( n% e
  2164.     creat_move_sign  ###
    / G* q& P" X: B4 X
  2165.     set_constants' i! d$ [+ T: r$ W
  2166.   end! j/ h* U' `% f" `2 B( t
  2167.   #--------------------------------------------------------------------------
    7 C! P% i! L5 F1 ]
  2168.   # ● 更新画面/ c! S! r% K6 b& @* X
  2169.   #     main  事件解释器更新的标志8 u. `. }5 D( Y+ @
  2170.   #--------------------------------------------------------------------------
    5 k9 B. B* c4 V( F5 y
  2171.   alias sion_mouse_update update
    0 O3 y; Z; Q! ?7 E0 `. H
  2172.   def update(main = false)
    ; p* i4 `; c& n, z0 Q/ s- Y
  2173.     sion_mouse_update(main)% t2 p8 l" ?* p) i0 a  }; {- g$ a* e* z
  2174.     update_move_sign& U0 D. s$ G- G$ n( t5 B
  2175.   end
    & R3 m' b. K* N$ Z1 @; Z
  2176.   #--------------------------------------------------------------------------
    ' Z$ @: m& ~, M1 i' J4 j% l; k$ c4 T
  2177.   # ● 创建显示路径点的事件$ G. f; K! ?! H! g2 |3 F
  2178.   #--------------------------------------------------------------------------
    ) S0 e: N9 m% f' ^
  2179.   def creat_move_sign; Z: y- `3 r' [9 T" Z7 ~
  2180.     $mouse_move_sign = Move_Sign.new  V4 u# G& a6 o- U6 ^6 v1 D3 ^* O
  2181.   end0 n3 f# p+ F+ o
  2182.   #--------------------------------------------------------------------------+ G- w. B8 S) R3 @$ C  e
  2183.   # ● 更新显示路径点的事件
    * D' e6 X1 F$ R9 T+ s+ |
  2184.   #--------------------------------------------------------------------------
    + o1 a! A: S4 b! V7 ]( R; ^
  2185.   def set_constants
    & k9 \+ R) N; W5 |- o  A" h2 `6 l
  2186.     @mouse_pos_setted = true! T! {3 k; M# v- {+ |6 {
  2187.     @set_pos_prepared = false
    7 z' g, Q% J; F  y" f
  2188.     @mouse_old_x = 0
    & X6 `+ A9 M# ]( n, `
  2189.     @mouse_old_y = 04 y. U2 B) G( P4 {* J8 ?8 E* q
  2190.   end& k% Q' }: M4 {0 v$ D6 _/ V
  2191.   #--------------------------------------------------------------------------6 U; w9 e0 i) X' _2 D7 A& B4 d& j
  2192.   # ● 更新显示路径点的事件  \. k- P' I" k5 |5 \
  2193.   #--------------------------------------------------------------------------
    9 ]3 ?7 z5 [: L7 f
  2194.   def update_move_sign8 P1 r. w& y5 j' t4 G# o
  2195.     $mouse_move_sign.update
    0 D7 k9 r/ C0 X; n5 c
  2196.   end
    2 Z" e, i# {& D# p
  2197.   #--------------------------------------------------------------------------$ P" b1 s5 l- d5 J9 K9 S. ?
  2198.   # ● 获取鼠标位于的地图块的x、y坐标, o1 ~3 U/ X1 H/ T/ S
  2199.   #--------------------------------------------------------------------------
    4 v9 }# O9 k* G- s2 Q9 i; _8 E( j
  2200.   def get_mouse_map_xy
    ! h6 U% a* Q: R0 K1 k- p1 K2 m
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y6 X. v5 H6 h( W) R9 n9 b
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    " a8 `/ n# f1 j  f+ j( F$ a
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)! [4 @  T, d3 ], g1 H
  2204.   end0 _# m# c' G4 r, K
  2205.   #--------------------------------------------------------------------------
    * R4 _. e+ E; V( V* x7 q+ K
  2206.   # ● 返回地图画面时重设鼠标坐标$ p5 `! K( Q- m* [; r8 E2 m
  2207.   #--------------------------------------------------------------------------6 V; Z, z3 W. B, r2 l8 r( N% X9 C
  2208.   def reset_mouse_pos6 t8 R3 `8 J$ M. s2 L( _" U
  2209.     return if @mouse_pos_setted
    ( C, k# d6 V+ E1 I0 W
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)7 G; i' j' L2 W/ S
  2211.     @mouse_pos_setted = true  R/ i: O1 ]9 D- T$ ]" I
  2212.     @set_pos_prepared = false
    % e* z! d$ q8 u% U+ A, d, ~
  2213.   end
    ) f% v1 H0 ]/ R% v$ [( D1 F; J
  2214.   #--------------------------------------------------------------------------
      ~& `) R1 m: Z5 p. B
  2215.   # ● 重设鼠标的坐标
    9 Z/ q: q' w1 Y  ^. Y* k1 s
  2216.   #--------------------------------------------------------------------------' B3 k- f" s& |  G0 o
  2217.   def prepare_reset_mouse_pos
    3 L- k9 S1 B: i5 p% B  d4 M
  2218.     return if @set_pos_prepared
    ; \8 }4 t) U6 x4 h
  2219.     @mouse_pos_setted = false2 p$ T, k) ~: l
  2220.     @mouse_old_x = Mouse.mouse_x
    0 B& l/ i2 z: {7 Y* X0 k( Y  |
  2221.     @mouse_old_y = Mouse.mouse_y  x  W$ H, y' P
  2222.     @set_pos_prepared = true* g, u" {/ M0 f" N  v! I# a5 d
  2223.   end
    2 [4 @% b* H- Q
  2224. end
    3 i; z+ ?, v6 @8 h
  2225. 5 N8 n' K% V' J+ X
  2226. #==============================================================================
    4 m( B# T+ `2 R; k8 E6 K/ z* z: F: M' o
  2227. # ■ Spriteset_Map9 O! D4 C' F4 k; E- J7 u: b. Y
  2228. #------------------------------------------------------------------------------, J- a! z' Q; Z8 r6 ]
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。) Q' Y5 L  L$ x
  2230. #==============================================================================2 j" X6 h$ B1 W8 o/ p4 y
  2231. class Spriteset_Map
    * h4 n5 Y( P1 O/ q. l5 t
  2232.   #--------------------------------------------------------------------------
      d* ~! ~. _" Y! r; T. o
  2233.   # ● 生成路径点精灵" L6 r& m% v! c1 J9 |
  2234.   #--------------------------------------------------------------------------
    ) F) G7 {. ]3 U7 F9 G: I
  2235.   alias sion_mouse_create_characters create_characters8 v8 e# X( b, d, i: i. G# I
  2236.   def create_characters7 p3 L1 q0 U9 ^3 k0 G( G
  2237.     sion_mouse_create_characters. I. N" ~+ o; ~
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))# z* o9 q) U6 Z0 q+ h, F
  2239.   end
    ' D$ Q5 p) N6 y0 c
  2240. end* a; I9 d$ _) i

  2241. 4 \4 P/ I) a7 K# T% a
  2242. #==============================================================================
    : n- z* J5 J( K$ m2 D* L
  2243. # ■ Scene_Map
    ' K& H( s" z& E
  2244. #------------------------------------------------------------------------------
    9 U3 `" }! m$ w/ o4 q
  2245. #  地图画面
    - X3 B" T) u4 F6 y* C# U
  2246. #==============================================================================2 O0 z, g% v. |, _; ]7 W
  2247. class Scene_Map  Scene_Base
    ' F2 E$ J/ q2 _# N7 x) l" R
  2248.   #--------------------------------------------------------------------------
    7 u& S/ L8 q3 O/ g# l1 M
  2249.   # ● 画面更新
    ( z/ [" x, ^3 ?; M5 e3 m$ J5 l
  2250.   #--------------------------------------------------------------------------* L* A; ?$ D8 n$ _
  2251.   alias sion_mouse_update_scene update_scene
    $ j$ A$ P5 I0 @
  2252.   def update_scene2 Y! a. d8 \6 m, q( _4 h
  2253.     sion_mouse_update_scene0 }6 ^# `2 X, A9 B
  2254.     update_mouse_action unless scene_changing4 [. h; I4 v* N
  2255.   end
    ' x6 [  b& \; n7 q/ S( g
  2256.   #--------------------------------------------------------------------------- w) s: j4 a0 A3 [" Z  v
  2257.   # ● 场所移动前的处理8 X( G1 J% M; ]: b! F
  2258.   #--------------------------------------------------------------------------
    , G5 m6 |. t4 ]" A: G) q
  2259.   alias sion_mouse_pre_transfer pre_transfer
      N. `1 P3 z$ @5 I$ W. B
  2260.   def pre_transfer
    ; x, z1 x5 S1 [" W6 W' n8 d0 t
  2261.     $game_player.reset_move_path
    ! W! m1 ~0 ~& R) I) h% O# u  ~
  2262.     sion_mouse_pre_transfer" s; K3 X  Z1 T3 g% I
  2263.   end! D5 o: |6 E/ g; o0 {0 q: k
  2264.   #--------------------------------------------------------------------------
    / L4 r- w+ ?$ F# Y* u
  2265.   # ● 监听鼠标左键的按下: U+ O2 U) ^; K, b* y& f& @
  2266.   #--------------------------------------------------------------------------
    ! @, m* Y2 G+ s% y& f
  2267.   def update_mouse_action( H3 \" h2 j# m! }* Q
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    ; @% {: l- @, g2 w9 l5 a, |
  2269.   end( Z' h* Q# ^# N) b8 g$ L- U
  2270. end
    ( [9 u" f4 ~: o% [7 v6 o

  2271. 7 g+ F9 j* i; E7 F  l
  2272. #==============================================================================( l% D7 N% q9 R4 m; l' S1 M
  2273. # ■ Scene_File
    9 q, d# Z( |9 F! j8 M; O
  2274. #------------------------------------------------------------------------------
    ( {% u# q) ]6 {, n$ b4 @& o- Y! C4 e
  2275. #  存档画面和读档画面共同的父类* c, u) m5 ^4 N, O( o- Z
  2276. #==============================================================================
    ' u5 C7 ~, C3 a4 i8 _; @
  2277. class Scene_File  Scene_MenuBase
    ; O4 u0 C8 x6 {+ N8 {, ?! O7 ~( \9 I
  2278.   #--------------------------------------------------------------------------
    - J. O7 h: v, f2 }1 U; h; Z
  2279.   # ● 开始处理4 M7 t% v0 \9 E
  2280.   #--------------------------------------------------------------------------& j4 Q6 F( C9 s8 x4 E! L1 @
  2281.   alias sion_mouse_start start
    : W: W1 Q4 D9 o0 }! F
  2282.   def start
    & O( ]4 C0 i% b. ]5 j
  2283.     sion_mouse_start
    * a( o- |! n& e$ V& q
  2284.     @move_state = 04 I  ?1 S) o$ g, j5 _
  2285.     set_mouse_pos
    4 m* c' t& l' ^
  2286.   end
    2 I$ M) y, k; \2 h0 R; x
  2287.   #--------------------------------------------------------------------------
    ' C& ?7 d" `9 f" o4 Y6 L: C
  2288.   # ● 更新画面6 ]1 k6 U  C( p4 r7 N" I, j5 C/ `+ z; r
  2289.   #--------------------------------------------------------------------------8 Y2 G4 h! x2 X* z9 G4 K% t
  2290.   alias sion_mouse_update update/ ?# S) W! g1 U$ i; ?9 v0 y
  2291.   def update
    - }% ?# m" S* T$ s" y
  2292.     sion_mouse_update: V9 p. l0 N9 ~, f+ P$ |% P
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos5 @. L& @) j6 a6 T, f/ J4 S4 d
  2294.   end+ u3 l# V1 ~# J  V
  2295.   #--------------------------------------------------------------------------  M8 k5 G0 Y! O7 f" Z5 S( |
  2296.   # ● 更新光标5 g6 C  V# v9 P/ ~% l
  2297.   #--------------------------------------------------------------------------9 S3 w( ]' o$ i* Z) g$ E0 F
  2298.   def set_cursor
    ! |7 U2 p* m8 R! v% i1 M' u
  2299.     @move_state += 1
    : l* h; r' I1 `& i5 h  A! z
  2300.     last_index = @index
    ! q! J7 i9 i' H: G( L8 Z6 ^
  2301.     if mouse_which_window == -2+ F& a6 b. \3 C3 m8 }
  2302.       if (@move_state - 1) % 6 == 0
    - w- }7 Y# [; \
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    9 ?% A$ Z2 X, A" S% m$ P( D5 b( x  M
  2304.       end7 H7 j5 [# j/ h& m7 q' s( m& `2 K, n
  2305.     elsif mouse_which_window == -1( T/ T, V% }& X9 q; c
  2306.       if (@move_state - 1) % 6 == 0
    $ U  b) }, k, f: @
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    . X9 z% m* |0 E, B
  2308.       end# a7 r4 Z! ^; G* t
  2309.     else/ @2 j8 ], M2 s( P1 V0 {8 @( \9 I, b3 T
  2310.       @move_state = 0/ {- S# B' V' _1 ], A
  2311.       @index = top_index + mouse_which_window: b% n8 Y7 u1 k" T' x1 Z& m8 |8 L
  2312.     end
    1 V* r. |5 z9 p6 @/ e
  2313.     ensure_cursor_visible4 R" K$ \$ W7 L& b3 T
  2314.     if @index != last_index/ D! b9 g+ k6 S# ]: l* _
  2315.       @savefile_windows[last_index].selected = false5 A. Z, r9 p! w9 k0 ~, e
  2316.       @savefile_windows[@index].selected = true
    : p7 o% d, o  ^$ r" t
  2317.     end
    ' a" ]; @( _9 x+ N7 i1 g( a
  2318.   end2 x4 w+ B% r" n# O0 A1 V
  2319.   #--------------------------------------------------------------------------
    " V4 y& N/ m5 m+ M1 M
  2320.   # ● 判断鼠标位于哪个窗口
    ; U; ?4 Q4 u6 \1 G4 M' X. j
  2321.   #--------------------------------------------------------------------------
    * K8 e, Y( V# M( e2 G
  2322.   def mouse_which_window
    ) U& J. o8 I! W
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    + K' k" N; V. _3 R5 t, b7 _
  2324.     if mouse_y  @help_window.height + 14
    - `) v: F9 U- U6 y. J
  2325.       mouse_row = -1, H* N' E# s; r
  2326.     elsif mouse_y  Graphics.height - 14& f# M, b1 w. s) ^, }$ L
  2327.       mouse_row = -2
    9 s- E# C, D9 H' n
  2328.     else* {, |/ }4 y. {0 O+ X
  2329.       mouse_row = 4  (mouse_y - @help_window.height) 2 W# M  w( H! M8 V  W$ R4 Z
  2330.         (Graphics.height - @help_window.height). l: X$ o6 n2 O6 z% S$ M
  2331.     end. _5 h, V  M3 K0 ?# M3 _6 z$ ~; f' O
  2332.     return mouse_row
    * |1 x# }) h) ~1 t4 R
  2333.   end
    $ r& S7 }% ~8 ?/ B# K
  2334.   #--------------------------------------------------------------------------3 _2 |: s- x/ H5 ^/ N  o& x
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置; {& P* p  H! y$ M
  2336.   #--------------------------------------------------------------------------1 ?2 l( F; L3 F  M# t
  2337.   def set_mouse_pos1 T. r+ ]4 y# w6 H! O- k/ F; D5 \
  2338.     new_x = 40
    % b% w8 |+ D6 \' i( D! ~
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    ) N- w' Q; r! t- p& Q) y( ?
  2340.     Mouse.set_mouse_pos(new_x, new_y)/ W( I6 E% b5 i+ d/ ~
  2341.   end
    : x) v, ~7 J  l0 N) t& P6 [* C
  2342. end
    ( @0 K! Z( B" }( X* l2 ]
  2343. 8 L1 U: A. a! Y: V$ h
  2344. #==============================================================================
    7 {6 Z$ p4 f$ g  r+ ^9 j
  2345. # ■ Game_Event* z9 d+ ]9 J3 `0 `! e
  2346. #------------------------------------------------------------------------------
    8 x% l% o3 O4 q9 U6 E0 P& q5 O3 F
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。" m/ E% V0 e$ e* `/ j1 @, B
  2348. #   在 Game_Map 类的内部使用。& c9 m' c  o* [- X
  2349. #==============================================================================, w) |4 `. N$ S* V, _  Y! ~
  2350. class Game_Event  Game_Character& T6 |$ e! T  F8 K" @! h
  2351.   #--------------------------------------------------------------------------
    * X% H; u& t, B( W8 S0 I! c
  2352.   # ● 事件启动
    9 t" i4 }1 Y4 r- _+ Z. h
  2353.   #--------------------------------------------------------------------------
    2 s3 o: [0 Q9 e1 W3 R
  2354.   alias sion_mouse_start start: A! O2 p  ~) r
  2355.   def start
    4 i9 v& p  B( ~" H. \7 I
  2356.     return if mouse_start && !Mouse.press(0x01)
    " g4 Y8 k9 M  S9 p$ E
  2357.     sion_mouse_start
    2 K( q: i% M6 W( H- C
  2358.   end
    6 ?) `: i$ K' Z. B
  2359.   #--------------------------------------------------------------------------6 ?3 ]6 p5 i- Y1 @3 S- E7 n( ]) h
  2360.   # ● 判断事件是否由鼠标启动/ Q4 B4 r% W" n' K6 ]( r
  2361.   #--------------------------------------------------------------------------4 q, V& |' G6 y' x# k& a& `
  2362.   def mouse_start! {0 X. V8 O$ V! v0 @9 B. u% a
  2363.     return false if empty
    ' a& H' ~' K; _8 g! D
  2364.     @list.each do index
    % _9 F* I1 s0 Q. o; D  U7 E" \( p
  2365.       return true if (index.code == 108  index.code == 408) &&
    % M) S, b% u6 x
  2366.         index.parameters[0].include('鼠标启动')
    % v8 H9 B! G0 a8 j7 ]5 f+ h. K
  2367.     end; e% s& c1 ^6 T
  2368.     return false* m- g: v' Y( ?) t; S
  2369.   end
    ; ?1 e" s& E6 b2 {( G' Y" m  |
  2370. end
      K+ x) g7 B1 Y! Z
  2371. 2 [% i4 F; X4 |& H" x
  2372. ####泥煤的height+ \# T6 Q3 C7 v8 i+ D5 q$ i
  2373. # @height = height
    * _* ?7 U1 m1 \- p3 Y

  2374. & N: D4 a- W6 A! ~8 Q
  2375. class Area_Response% J$ \$ T5 w; l7 u
  2376.   attr_accessor type3 {0 S9 L0 \9 x9 \3 B
  2377.   attr_reader ox6 G/ K7 K! ~/ J# c
  2378.   attr_reader oy
    " O) s5 E- A5 F0 B" N9 L# R
  2379.   attr_reader width
    - W1 i7 ^* c" n3 p
  2380.   attr_reader height
    & j; g9 j9 {' y) k+ p% W! x5 x$ V
  2381.   attr_reader switch_id( o! i' n$ E0 r' N6 z0 s9 V0 L, i' L
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)3 Q# z% P" N: J9 E1 u/ `6 c8 G
  2383.     @type = type
    8 m3 U( ]! g' T
  2384.     @ox = ox% ?/ j( n# [8 ^
  2385.     @oy = oy
      X  b  W) [) z2 O4 s" s  q. T8 A$ Y
  2386.     @width = width
    ! O$ Z6 F& m1 U$ y; p$ D) R! A6 o
  2387.     @height = height9 P  ]. I5 |- g* |+ ]) M! t
  2388.     @switch_id = switch_id, D5 m3 u5 h: P! c1 K$ \
  2389.   end
    " b$ y2 X1 @) R5 ?1 a3 D
  2390. end3 {( Q6 n! |0 b. }6 L

  2391. # f& K% P8 h2 O, U7 m
  2392. $area_responses = []
    ) Z3 [6 s" k9 S. O( Z( V
  2393. $ O, k. l  Q! p: p6 s; j3 x
  2394. class Scene_Map
    * ^4 O$ [% @$ R$ W6 |
  2395.   alias update_mouse_2013421 update_mouse_action
    ; X( p6 r/ {& P  u8 D8 {$ V
  2396.   def update_mouse_action
    1 h3 I$ _# C+ o% X+ O3 C
  2397.     update_area_response
    + v& x& ]& R. o: `5 f
  2398.     update_mouse_2013421! ~8 L: D2 ~9 e$ }
  2399.   end
    $ F: l$ Z6 R3 x9 X( O5 [
  2400.   def update_area_response, o2 R  x: X3 D  l! u4 v- T
  2401.     responses = $area_responses
    % g0 G% {& a+ I4 P; b
  2402.     responses.each {response
    ( d5 G, N9 d5 [3 `. p
  2403.       ox = response.ox: l4 }2 V& _8 `; v2 ^2 f: L) O
  2404.       oy = response.oy# V% M; D& c( R+ G- N+ {
  2405.       width = response.width& p+ Y* k8 Q7 ^- b/ k  i
  2406.       height = response.height
    + n4 X3 M. T5 ~5 ~% q0 o+ V
  2407.       switch_id = response.switch_id  Y, j0 N9 ~; s, X! X  ?' M
  2408.       case response.type% w! c) G5 L% L; R
  2409.       when 08 Y  H, G- i9 _: v5 T
  2410.         if mouse_in_area(ox, oy, width, height)
    ) V2 v$ A: V0 e+ v9 n
  2411.           $game_switches[switch_id] = true
    , a' B- }9 L! n  k9 M& f4 M8 C
  2412.           $area_responses.delete(response)
    8 T. ~6 M# K. q/ B, C) t6 @1 z' B
  2413.         end/ l6 V7 |! w- V' Y8 N7 k- g2 i
  2414.       when 1
    3 E- ?% ?1 c$ J$ l( ]+ U. F
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)7 I" h9 V) S( B3 i4 I
  2416.           $game_switches[switch_id] = true
    $ d- Q# X+ Y8 Q# R5 z2 M8 K
  2417.           $area_responses.delete(response)" j* f5 l9 p' W, w3 J+ N- g
  2418.         end
    ( b6 o5 J! }& S( b9 l5 j
  2419.       when 2
    # H: Z! t& k# S; m% ^) e
  2420.         if mouse_in_area(ox, oy, width, height)+ B+ V  f3 ^& u3 Z
  2421.           $game_switches[switch_id] = true
    : q: c# e* n4 S! a; y0 `
  2422.         else
    4 q8 I( Q& v! w4 {% S+ Z' ^
  2423.           $game_switches[switch_id] = false# @: _' }8 ^) y! m2 l
  2424.         end4 R4 l" {6 t3 a# V  h% S$ r
  2425.       when 3/ o7 X: g7 f  [6 d5 U$ z6 H
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    8 z! T1 h9 M# @3 _" Z- P9 O
  2427.             (oy - $game_map.display_y)  32, width, height)$ m0 i" G$ E( v8 R
  2428.           $game_map.events_xy(ox, oy).each {event
    5 T$ k3 W# l* E& M/ l( w2 s
  2429.           event.start# t6 V1 V+ a- ~7 s. C  h4 _3 T8 U0 o
  2430.           $area_responses.delete(response)" A1 t; m, b+ \6 V/ U- a
  2431.           return
    # y9 `# U; X$ q' |+ q+ _) D
  2432.           } & {. o! a) |1 w* W% x, {& A' W
  2433.         end& ]8 W1 |" n2 q8 C
  2434.       when 4+ S) L: M: Z' [* x1 P
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,, s" L" k$ n/ ?  ?  `
  2436.             (oy - $game_map.display_y)  32, width, height)7 p- @- G2 G+ h+ W$ N- `
  2437.           $game_map.events_xy(ox, oy).each {event2 R, L. r, k  u" R! y4 `' `3 A7 ~
  2438.             event.start
    7 b, k; L( C* n- n
  2439.             return: S) y3 z8 i% C+ B* H
  2440.           }
    ) K" a! c( B6 r
  2441.         end
    ' ?. o8 ^/ k0 l& Y
  2442.       end
    ; {& d5 J# v2 W$ ^1 u. Z  @; I
  2443.     }2 J. }7 P6 G: P) [% r5 h) Q
  2444.   end8 \/ i' ]" N0 [
  2445.   def mouse_in_area(ox, oy, width, height)" E$ ^) H. v, h8 i: ]% u+ L
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&: V0 b' {: A) q
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    9 c9 F9 Z" \; @2 v& H
  2448.   end1 t2 `" j- O" t
  2449. end' i  u/ \& Q* R. x8 m6 U3 s
  2450. class Game_Interpreter
    7 ]$ ^/ Q& B& D6 G% i6 n  d
  2451.   def area_response(arg)* m. B0 O  Y9 `7 ?- [5 i/ ^1 k
  2452.     $area_responses.push(Area_Response.new(arg))! _6 c$ s7 a3 Q+ k0 q. K* A( L
  2453.   end
    2 \( w  `0 P3 e, [
  2454. end$ V7 @1 x, x* l. E) l- G6 c7 ^0 }
复制代码

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

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

GMT+8, 2024-9-20 19:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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