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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    ) q7 K3 |) m% q" j$ o1 a' v
  2. * h+ g% V  K- D6 x9 q. K' p" K
  3.   Sion Mouse System v1.3e
    % f: k" y4 _! l7 T9 @0 Y6 A; q
  4.   
    3 Q6 X, x) ~# s7 o7 ]6 M
  5.   Changlog- }. y- ~* C0 M
  6.   
    3 m% O1 g; {4 T# b3 t; C5 i4 B- Q
  7.   2013.4.21 v1.3f
    ; v6 L$ ?5 D5 g6 {& H. M
  8.    
    4 x( ~& w9 B1 c
  9.     1.3f 卷动地图 bug 修正
    $ M- X7 r$ y7 v2 O& {2 {$ E2 z' `: t
  10.     ) z0 q. o0 E" n: |! d0 |/ z
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口0 h; E9 u) K' e7 B3 ~
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内2 `+ Q3 j4 C7 b# E# N2 J+ S
  13.                               Mouse.unlock_mouse_in_screen 解除锁定& e6 x$ y6 ]$ H0 G' K; m: M
  14. 9 A! L3 X5 g1 W! g* r. O* y% o
  15.     1.3f bug修正* u1 P4 y: k/ t' ]
  16.   ) Z9 J+ ^* @) x! D$ b: W
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    6 E% Q  b9 k2 H9 E
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    " g1 N, p8 p; P

  19. ' E8 E& ?1 v# e1 c, _. c
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处4 _6 M# O1 K4 W% p, s9 Z& j9 @$ f( A
  21. $ O; F9 H0 Z# t5 d/ y, j
  22.     1.3b 修正一些罕见的bug;
    + C2 V" {: n+ Q% Z

  23. ( ~0 f: n7 H8 m
  24.     1.3a 代码小修改;( n. \; _7 B2 H0 C; i8 K0 {1 k
  25.           加入了鼠标点击启动事件的功能," h+ a+ Q" |. Z* K
  26.           在事件中加入“注释”: 鼠标启动  ,
    2 |7 q- i- K2 A1 w+ n* }8 o* n: m+ E. o
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。, E' O% O. @; A# N( Q# Q' k8 L
  28.   
    5 S8 w4 o6 s/ J* \- [2 H
  29.   2013.2.12 v1.2
      k) o4 {+ p: j' E9 K
  30. 7 R. s9 Q' M6 Z% F
  31.     寻路逻辑优化;0 w5 N1 W; {+ z, E1 k
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;$ B( X; g% A9 b8 V
  33.     现在支持用鼠标来操作载具了。$ m" q7 x. q' Y/ ?0 U: I" G

  34. * r/ B' O$ Y( G1 M# ]( i% L
  35.   2013.2.8 v1.1, f" j% p7 O% C% P  ]5 j% f! F" V
  36. - n2 B/ L9 x  X- b$ Y
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;4 C, _2 g. j" I" q) }* t
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    7 y. O" B" C/ c! U$ w; Y9 I
  39.     移动时,路径指示点的绘制更加稳定;
    ' @6 t; W+ B. n$ z
  40.     现在支持默认存档画面的鼠标操作了。
    9 e6 `0 t, x, U; c6 K: A% A
  41. 3 V0 C* E  B1 R0 j2 H
  42. ; y; a( y( [, }; @, K& P
  43.   OrigenVersion
    0 |( `$ v7 `' \0 O/ s( M) w9 v
  44.   
    ! ^4 O3 B; F0 v3 X! f1 D
  45.     2013.2.7 v1.0
    + e' `$ |: G' c0 |4 c4 {' x
  46. ; g% k  M4 Y& P
  47.   主要功能
    % c5 Z$ F6 I9 L* _

  48. ' R4 |. J! w# o7 ^( q! `
  49.       使用鼠标进行各种操作...
    * Q0 v& }: c) B* O/ r
  50.       将鼠标锁定在游戏窗口内
    ; w% d: j/ ~/ Y% s6 M) \2 D% @" h
  51.       自动寻路,按住 D 键可以扩大寻路的范围7 _& K/ P% A, |+ Q- P9 S: V
  52.       双击鼠标进行冲刺
    & P0 K6 L( H) x8 k
  53.       更改地图卷动方式以适应鼠标移动9 ^( r( {# P3 s5 x* y4 g% \
  54.       变量输入框改良
    1 u4 l7 C3 q0 t

  55. + j" A5 I% h% ^: S
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    8 h+ |2 k, u0 A3 e( `  g  }
  57. * o& f* F( p! r) j9 P# ]+ U
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹' x7 \# S! u3 Z  j
  59. : i! I/ V6 y' h- A; T* W
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭2 H6 A* I( ], m& r, I
  61. 1 D! }5 U1 l$ }; ]* d
  62. - V) k# c, s* L% n* @
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★8 n6 b+ p% E* X+ c& z1 T" Z% U
  64. " v9 D" y, `' U
  65. & d' `1 ~/ H8 ~( z, C
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    ! y# x3 H$ w$ J* H# e' P
  67. ( i7 b2 Z( Q8 {
  68. #==============================================================================
    , Z+ i$ n' X6 d0 g0 R
  69. # ■ 常数设置
    & |' q& w' q% W1 K: q" `
  70. #==============================================================================7 X) B! T" [& J/ `; b
  71. module KsOfSion
    ; O+ _+ X5 p! ]  n+ {- o: l
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    " Q+ _* p, t# h- o1 H
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑: I+ f+ t  d2 y
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    : ^$ z* E! Q( `- x+ H
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    # l5 l% l" g8 A# U: {4 t
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
      {) K& e" B6 q
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧( ^' \5 q" t, P5 n; E! Q4 s
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)" v# X% `7 j! a8 X; q
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键0 x6 |0 _$ u$ C
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    ) M: V2 b: s* K  ?3 f$ H, w  v5 J3 t
  81. end
    & g2 M& m- h- V* a

  82. . Y$ d& V4 r1 f, ]" _
  83. #==============================================================================8 }5 Y' G, W/ @
  84. # ■ 用来显示路径点的类
    ; g# f8 k" l4 w( y$ A1 A: b
  85. #==============================================================================, K+ w+ O" w7 F$ s- f
  86. class Move_Sign  Game_Character4 F% Z: A' [  g% A/ v( d
  87.   #--------------------------------------------------------------------------
    & Q& z& K! R0 \! W6 V
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    $ h- o8 W- P0 E) B! ~: r: v
  89.   #--------------------------------------------------------------------------% K% K" q  \, o' t
  90.   def init_public_members
    $ e( ]' R( ^0 \+ A
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    1 M( V# e6 Q9 Q' b$ Z- @% d! j
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为07 x5 X0 i# L2 j4 N5 R
  93.     @move_speed      = 5        # ★ 踏步速度& e% g3 E: J9 h5 B! o% T
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)' z. F) N( x. x" R: G+ n3 F
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    % J) D2 Y. ]0 J3 T+ J
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    % z% l/ ]0 |3 D' C% @% ^. L, @; J
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列/ M: J7 v) l8 J+ p. R; c8 o% n
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)/ P5 G$ h- t% `8 S$ L

  99. % W) u7 H4 v' g$ c/ D

  100. * Y% Z# u8 g, q0 R
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    9 v) e3 U: Y/ W4 I/ ^

  102. 8 g9 s$ ]5 b9 g' n

  103. + z3 j' X7 U( `1 A+ q
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    * A, _- r) ]& T( ^+ C# x8 R2 l
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    + y4 }8 {/ @; J7 ^' W
  106. 6 Y7 l9 j& E% b. D+ ~, U) Z* y5 H: p
  107.       if $no_arrowpic_warn
    8 J2 O0 i. i1 Q7 X+ [
  108.         MouseShow_Cursor.call(1)/ l! q1 E; P1 ^8 S* e8 Y" a9 G+ m
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png1 S+ U  N) }* ]
  110. 8 T; u4 T: [; n% N+ W
  111. “路径指示点”将使用游戏自带图片
    ; h7 n; g% h  H2 i6 F5 a3 n9 o- o

  112. 3 O) v2 P/ o, }: d7 R6 y4 o
  113. 该提示可以在脚本内关闭')4 A/ v' w6 O+ T# Q0 j+ b* ^
  114.         MouseShow_Cursor.call(0)
    ( v* Q8 Z* h9 t. D0 k3 j
  115.         $no_arrowpic_warn = false, _1 \' v- E+ R4 l
  116.       end
    9 |$ o. E$ ]0 u- a0 `
  117.       @character_name  = '!Flame'4 K+ t9 O: f8 @8 n. b: s: ?
  118.       @character_index = 6: o& l: S" b, m: u

  119. ' n5 N5 M$ L, Z# d* j% x
  120.     end
    ; ~; `  s7 ?$ Y( _% H
  121.     @direction_fix = false  # 固定朝向
    ! {/ W# D; Y3 h3 F6 x
  122.     @move_frequency = 6     # 移动频率
    0 \( ], `) O; h! Q4 X
  123.     @walk_anime = true      # 步行动画6 Q, ?# t) {3 ~
  124.     @pattern = 1            # 图案8 @4 D3 u7 h! P' n% _* n7 i
  125.     @through = true         # 穿透
    4 ]) \; X9 ?6 v
  126.     @bush_depth = 0         # 草木深度
    * `4 B' @" {* e: l9 z
  127.     @animation_id = 0       # 动画 ID
    2 q% {/ w6 x: i$ J, `
  128.     @balloon_id = 0         # 心情 ID
    - ?: X0 [; L% l' @% S: n
  129.     @transparent = true     # 透明* {0 f0 |# D6 s! I4 d
  130.     @id = 00 K4 @/ Q0 E& \7 v. k; w3 D/ D8 K, u
  131.     @x = 0: a9 ]! h1 F) K: c
  132.     @y = 0! _3 b- p; V$ j! z0 I" V
  133.     @real_x = 06 O6 |* l! p5 }8 ~4 B7 G$ ~
  134.     @real_y = 09 k. W/ M8 W2 _/ k$ N1 S
  135.     @tile_id = 0
    0 d+ U! \' x9 |2 t. S
  136.   end% l' }* _0 i0 x
  137.   #--------------------------------------------------------------------------6 ^1 E, M/ g: r8 e+ X9 T* o
  138.   # ● 定义实例变量
    - P$ K6 a& x: ^- `7 ^: L7 S' M
  139.   #--------------------------------------------------------------------------
    8 W- M; T. n' e0 |0 N/ G2 C
  140.   attr_accessor direction
      i( }3 D+ i& o/ L
  141. end
    " M, }; B2 o0 ~: p
  142. * \4 j  ~5 N2 {$ ^% ^6 I
  143. #==============================================================================9 J' [: c. m" M% }- }) b
  144. # ■ Module Mouse# u3 o8 z/ l5 \/ ?% ~6 ]  y
  145. #==============================================================================) h; A% H+ |6 n1 W
  146. module Mouse: b3 p% J7 Y2 ^  x" P) f& t: u5 P
  147.   #--------------------------------------------------------------------------
    0 h5 @; X# _- m) E8 c
  148.   # ● API. p! l4 Q/ |$ `
  149.   #--------------------------------------------------------------------------6 O/ Q- L5 v; ~% N$ P
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
      q: m2 \+ f1 ]/ @3 t7 l
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    6 H! E1 I0 k# b
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')* i$ |" }9 Y+ S$ D0 u
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')& Q  _4 d6 j' t6 v
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    / c. t: G# I& Q% g/ K1 d
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')% \: ~1 x7 i% C& i  w; }
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    ; I: z5 x. F, |
  157.   Window_Hwnd       = Get_Active_Window.call
    " N: D" Y1 c; h: C! X' P
  158. $ [& T: e" G! l3 Z" M# `( v
  159. class  self
    9 t7 r, h+ ]9 R
  160.   #--------------------------------------------------------------------------
    1 B# `" X8 v- k, J  R" v
  161.   # ● 初始化; y" u3 Q# T) f' `: F
  162.   #--------------------------------------------------------------------------
    7 |4 x, W9 G) F3 J% F
  163.   def init0 Z- I& P1 }1 K( R9 J
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor: L8 ^( i  ^0 ~! @/ R
  165.     @left_state = 0( ]5 ^5 P. f4 G9 D" ^; N6 N( m$ i
  166.     @right_state = 01 e# D1 u' Q4 m
  167.     @ck_count = 0 # 帧数计,单击以后从0开始- }/ y( N  j" I5 n7 J- d
  168.     @dk_count = 0 # 用于双击的判定
    # t. z- @/ u8 N. e
  169.     @clicked = false
    ; H; h4 s% B% y4 W7 N% V# U9 V
  170.     creat_mouse_sprite
    ) h1 K' s$ N* e6 ?
  171.     update# J' j" t, P4 D, l' w
  172.   end
    & j  W! R% K/ }4 n. X/ ^- {
  173.   #--------------------------------------------------------------------------: o- z! n+ o7 r- T, N/ v
  174.   # ● 鼠标指针精灵
    9 A+ t5 @, T" w7 q
  175.   #--------------------------------------------------------------------------
    - u( h. S2 l6 v+ w7 |, V
  176. #~   def creat_mouse_sprite8 m1 |0 @( D/ E. L$ [
  177. #~     7 A& A7 D  a- z* o' D
  178. #~       @mouse_sprite = Sprite.new& b/ ^2 H& S( o6 t  M( \3 b
  179. #~       panda = 2#rand(2)+1
    6 N+ i$ L# ~; H( k6 L0 ^4 ]

  180. , C/ F3 c" I# p2 y  @( [+ h, A
  181. #~      if panda = 1
    " w/ y8 u( H3 ~) H" V$ ~
  182. #~        if File.exist('GraphicsSystemCursor2.png')0 I$ U- k5 e; ~/ M9 O
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')- e" S5 a3 K% t
  184. #~        end#with if File.exist
    5 S/ W' U6 Y$ l$ o- \
  185. #~    . u) s6 Y) t, ?  U% p
  186. #~     else if panda = 2 #with if panda=1
    6 R1 n- q: D. D9 T: }* s! u/ u( ?' Y' q
  187. #~      8 V* D! p; ?6 H  u8 q0 q! ]/ d. W8 E
  188. #~      if File.exist('GraphicsSystemCursor2.png')- X! ]: p3 h6 ]/ F3 F
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')5 G* H8 E; e% X/ N
  190. #~      end#with if File.exist
    1 C* r. Q- l1 n% l; u+ ~
  191. #~       $ T2 O) {' h8 I7 j
  192. #~     else #with if panda=1
    2 p; ?+ j# `  S$ q, a! g" w3 b
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)3 L! m  V9 }3 [6 W
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),% {! f- n6 m: W
  195. #~       Rect.new(5  24, 24  24, 24, 24))! S$ h3 X# T1 _; k
  196. #~     end#with if panda=1+ A. j5 |7 N8 z$ |
  197. #~     ; m' L- r4 K  k2 @7 z$ k
  198. #~     #with def( M- T- x" v" G
  199. #~   end
    0 Y! P) g3 m2 ]
  200. def creat_mouse_sprite: W) e4 j- f3 m4 Y6 L
  201.     @mouse_sprite = Sprite.new3 z' x, r! o' [- B& L
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})5 E" D  Y; S( {
  203.     @mouse_sprite.z = 9999
    4 c% S4 r' c- X- G  }; E5 Z
  204.     Show_Cursor.call(0)
    " p& }! ?$ X% r! U2 Y
  205. end
    : x. t5 N: u6 N

  206. 0 Y8 `$ Z( r( ^+ y' k, S3 J6 s* d% w
  207.   #--------------------------------------------------------------------------
    4 m; z" y  s% U6 P  h3 t( \/ X
  208.   # ● 更新" L0 \2 L. z( R( ~) }9 s
  209.   #--------------------------------------------------------------------------6 O2 r+ s  d. x2 g9 x6 P
  210.   def update- {& S9 z) x: d' Z
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    8 |& t' ^! X4 ~" f, \" X5 E
  212.     left_state  = Get_Key_State.call(0x01)
    8 [0 n3 S; r' R4 P
  213.     left_state[7] == 1  @left_state +=1  @left_state = 02 L& m+ D+ q, b$ X
  214.     right_state = Get_Key_State.call(0x02). U+ V1 \4 C# d0 S7 x+ B6 F4 Z$ w
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    9 Y% V8 ]( m4 \9 v1 h2 ~5 R
  216.     update_double_click
    1 M# j9 a# E$ z% g5 J* ]. I
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1, R2 ~3 k" S7 f: [/ c- c& ^. x
  218.   end$ h+ X$ T) G; _; Q
  219.   #--------------------------------------------------------------------------
    ! b" r1 s3 h& J" S
  220.   # ● 获取鼠标坐标% P) R5 P: Q& K
  221.   #--------------------------------------------------------------------------( o, V, @4 g" T4 O
  222.   def get_mouse_pos
    ( A  S1 G) o. ~, w" y
  223.     arg = [0, 0].pack('ll')4 x; M$ z6 j. x/ Q
  224.     Get_Cursor_Pos.call(arg)
    # L1 @& m, \2 P: S7 {
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    + l: s7 o& b& [' L1 Z5 T
  226.     x, y = arg.unpack('ll'): j1 J0 @) D4 m$ e. p
  227.     return x, y
      j* v& h* |) H. J2 X
  228.   end1 p( H& T* I. ?" A0 b" ~' Z
  229.   #--------------------------------------------------------------------------1 \& }/ a- t* s; ]
  230.   # ● 将鼠标固定在屏幕内% C( L6 I5 C# x' b  n
  231.   #--------------------------------------------------------------------------
    9 J% i: |$ i( N8 ^1 ^
  232.   def lock_mouse_in_screen
    0 m: b2 s( a. ]) D4 P) l; O
  233.     arg = [0, 0].pack('ll')% z6 H" f. r: g& R
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    - q6 V* [2 y# p
  235.     x, y  = arg.unpack('ll')5 W! \3 w- W2 r, t
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))' r6 {- P5 j9 \3 C9 L% d
  237.   end
    4 w4 l! I9 t. b
  238.   #--------------------------------------------------------------------------; F$ _  J* w1 \* y: W; H& H: f/ @
  239.   # ● 解除鼠标固定
    9 p/ R! [3 j6 Y  k
  240.   #--------------------------------------------------------------------------
    / n5 B- q6 T0 y  c+ B
  241.   def unlock_mouse_in_screen( Z. v# X8 C- K0 O
  242.     Clip_Cursor.call(0)  _5 R$ p  z4 r
  243.   end
    ' v' M' \9 Q! F% f0 G$ k
  244.   #--------------------------------------------------------------------------
    + d$ Y. d& L3 E" Y* `
  245.   # ● 鼠标双击判定  X2 W) t2 Z# s- d4 N: [
  246.   #--------------------------------------------------------------------------
    8 w. V; M9 h4 _) h& C
  247.   def update_double_click
    9 ^% E" @: t. A4 E" {
  248.     @clicked = true if @left_state == 1
    ( O2 r- E- G8 p0 Q8 j
  249.     if @dk_count  0 && @left_state == 1
      S. f8 _  ~$ [* E3 b3 G6 b
  250.       @dk_count = 0; @clicked = false0 P) E: c! J* s2 h
  251.       return @double_click = true
    3 Y) W! f8 Y4 y( C+ g' ^# F  b0 c6 X8 P
  252.     elsif @clicked4 U9 S, M7 A* x: w
  253.       if @dk_count  KsOfSionDbclick_Frame( `$ L& C9 @) K
  254.         @dk_count += 1# E% g7 |( {5 c7 n! S5 L" ?
  255.       else
    / |. K% d$ j+ x
  256.         @dk_count = 0; @clicked = false" k& ^- S  ~1 o" s0 [0 S' |
  257.       end. L& }# L2 q% K$ ^# w( z" ?
  258.     end
    5 k* V! z8 v1 J$ U
  259.     @double_click = false
    7 P% B/ v! K$ N) T4 H$ J
  260.   end
    - B. ?. l* C% L5 P
  261.   #--------------------------------------------------------------------------
    1 y4 i' Y2 a  @. {+ a6 \0 z7 f
  262.   # ● 按键被按下就返回true# ?& S. V( t( a- I4 S; ^9 u$ q
  263.   #--------------------------------------------------------------------------
    % ^# c/ F& }4 h9 U& X8 E) U
  264.   def press(button)
    / m1 }. v7 g" }
  265.     case button3 O- G" a) [1 U( m) [
  266.       when 0x01; return !@left_state.zero8 n( ]9 t* ^& U. s* @
  267.       when 0x02; return !@right_state.zero
    5 x" s  u% A, T3 W6 C8 f6 f$ L! X1 a
  268.     end
    . W7 T! f: X0 d: Q
  269.     return false1 `( P* P4 U& k# {
  270.   end
    $ B, ^) e$ n+ q0 a" O( \
  271.   #--------------------------------------------------------------------------
    7 |' _' \( G, _: {4 h
  272.   # ● 按键刚被按下则返回true
    ; u6 i5 D) ^2 k( r0 G
  273.   #--------------------------------------------------------------------------
    ! x2 ~0 @1 \3 i) c3 L6 _. w2 E
  274.   def trigger(button)+ P: v0 v3 \5 N% D
  275.     case button
    & p1 B) U2 d+ j3 F2 n. ^* }
  276.       when 0x01; return @left_state == 1
    7 b5 }7 o6 `. B9 o
  277.       when 0x02; return @right_state == 1
    ) S: ~2 p9 c* K6 p$ O1 A: W, n
  278.     end4 q) N0 R. l9 H0 L' s
  279.     return false
    ' \: r6 d0 p; b% ]1 ~3 c
  280.   end! u$ a' q. P3 m* v. ?8 {' b
  281.   #--------------------------------------------------------------------------, [8 x( T6 t* G1 v8 C
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true" C2 `6 t( m; J$ ]" v# Z5 ]
  283.   #--------------------------------------------------------------------------7 M1 r. y" W5 `+ P- A; ^1 a" F
  284.   def repeat(button)) ?% c2 s: P9 @/ |) w, W
  285.     case button
    : T$ D" G& K# j
  286.       when 0x01; return @left_state == 1 ) ]) o& B  \  Q, K- y
  287.         (@left_state  22 && (@left_state % 6).zero)
    . K9 W# n. d3 `: s5 A7 ]) M
  288.       when 0x02; return @right_state == 1 / N" X+ m' D/ Z" `. z& T
  289.         (@right_state  22 && (@right_state % 6).zero)9 ^0 t/ P2 W% [& g  f4 u
  290.     end/ V0 Q; d% p0 i
  291.     return false
    ) [6 V4 W1 N8 c" S" s1 ~
  292.   end9 i# @% F  m% F- P- T
  293.   #--------------------------------------------------------------------------
    # k3 @. _1 m9 L
  294.   # ● 判断是否双击鼠标3 k3 d+ O* Q, K9 _/ p0 H) T
  295.   #--------------------------------------------------------------------------3 s) y# l4 _; y' L- u& e" D4 B
  296.   def double_click$ w$ h  r' u. q
  297.     @double_click& P( k9 B# F' a: g1 z' V
  298.   end
    ! U3 B$ F7 }0 H4 x0 x: T% \# s  A6 T
  299.   #--------------------------------------------------------------------------
    / Z' {- D+ k' {% S6 f. J" G9 i, y! P
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)5 m2 S6 q2 F# L
  301.   #--------------------------------------------------------------------------# m6 s: d7 s1 G) p2 f6 P
  302.   def click_count
    . E6 L7 x( J* u9 R
  303.     @ck_count) W/ K% c6 R; [* |+ s
  304.   end* E3 s9 E  V: x4 p: e
  305.   #--------------------------------------------------------------------------# [" ]: _1 o  d/ m$ E
  306.   # ● 获取@left_state(按住左键每一帧+=1)) P& e- X, P1 Q7 Z8 K! K: F# ?8 j
  307.   #--------------------------------------------------------------------------
    , \6 x+ R8 W2 _6 Z0 W; Z4 D( @: k  t
  308.   def left_state; b0 K  n0 J; [7 o/ U1 C; Y, L
  309.     @left_state
    9 ~- g, e) p5 d
  310.   end, n) x/ d* z& `; i: Y5 y
  311.   #--------------------------------------------------------------------------& h4 u( K3 Q* }9 L( I4 ~4 o
  312.   # ● 获取鼠标的x坐标
    4 `, i1 F0 C  D( w$ C, I
  313.   #--------------------------------------------------------------------------& L2 `3 B. W3 ~8 ]" u7 r4 [
  314.   def mouse_x
    * V- M; b# q! h8 O- F
  315.     @mouse_sprite.x" S' }9 f6 F- R, I
  316.   end  D, b  M. t# c) Y8 ^% l3 Z# e
  317.   #--------------------------------------------------------------------------% D+ M: q3 G  A
  318.   # ● 获取鼠标的y坐标
      d( K; H) R7 _
  319.   #--------------------------------------------------------------------------: J0 g0 U0 F6 ?! N* e8 Q' G
  320.   def mouse_y
      D3 B$ h5 O: r
  321.     @mouse_sprite.y* A0 [9 D6 K, Z4 ^- j! e
  322.   end/ X5 G( {4 d' S1 z
  323.   #--------------------------------------------------------------------------+ A- x+ K$ Q4 X) B. U/ ]0 m5 t
  324.   # ● 设置鼠标坐标
    $ y1 K" U/ z' D4 f/ C) R9 Z0 `- \
  325.   #--------------------------------------------------------------------------  e9 z9 ]8 h/ B
  326.   def set_mouse_pos(new_x, new_y)  N2 k" M0 g+ S7 ]8 b) S
  327.     arg = [0, 0].pack('ll')
    2 A, k2 r; [- b/ ~) U7 e# I
  328.     Screen_To_Client.call(Window_Hwnd, arg)- P7 B8 U% O. b( ]- y
  329.     x, y  = arg.unpack('ll')% t" M. A: i6 S
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    0 V# ^: v1 w% i0 t' A' Z& u5 V
  331.   end' x- y. P& M/ y& E6 P. U  N
  332. end #end of class  self
    % X/ }# P' P% D$ w1 |& I8 W

  333. 3 T9 ~: ]$ F( {+ x3 F: n- v
  334. end
    3 {  N% Y* Q+ w& h7 u  c

  335. ! l4 t! y1 u- H- J8 W0 ^  P
  336. #==============================================================================
    0 w5 V$ d6 s* @( N2 t
  337. # ■ SceneManager' c7 @( m/ F" V* `! j$ u
  338. #==============================================================================3 D. u; b6 s7 Q
  339. class  SceneManager
    : c  S/ @5 g# d
  340.   #--------------------------------------------------------------------------( y3 i7 g0 ]! v* n
  341.   # ● alias
    9 J% Y9 E) [6 G. Q# q7 G- o
  342.   #--------------------------------------------------------------------------6 b- |& B' N8 b. ~; }  ~* H
  343.   unless self.method_defined(sion_mouse_run); L4 v9 l) N( P+ B
  344.     alias_method sion_mouse_run, run7 M8 N+ g9 E6 V
  345.     alias_method sion_mouse_call, call* E  y! W# q4 k- z
  346.     alias_method sion_mouse_return, return" }; \+ {& Y% F$ b
  347.   end
    ) ?0 c1 k5 x0 h) e
  348.   #--------------------------------------------------------------------------
    ! i* |# m/ E) @$ L+ v( M+ H. R
  349.   # ● 运行" H  D  F4 o, u; g; g; B: v% F
  350.   #--------------------------------------------------------------------------
    1 |8 Q  f9 N; t  H* v
  351.   def run
    ( O2 O' t; T+ P6 M& A! V, N8 l
  352.     Mouse.init  H% _4 X) F8 ~. }) Z0 x4 Z
  353.     sion_mouse_run6 s. x6 B3 ]9 r$ p6 q. f
  354.   end
    0 m6 R& ~8 {" Y. k/ O
  355.   #--------------------------------------------------------------------------
    8 |$ C* e* |+ \5 w! `7 j# V' U
  356.   # ● 切换" }0 b3 D" v' K) a
  357.   #--------------------------------------------------------------------------) N; b3 ]' ?2 i1 U. t8 V6 c0 g
  358.   def call(scene_class)
    - y, x5 ~# ^$ ?
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    ; o% l! a* L; U  d8 H
  360.     sion_mouse_call(scene_class)
    + v- h9 V4 t& ]4 s! C! Z
  361.   end
    # L, g$ k2 Z% y. O; |- ~& D
  362.   #--------------------------------------------------------------------------
    5 J7 H  Q" x3 Z5 f' c/ B
  363.   # ● 返回到上一个场景
    : q' m" H( h# g
  364.   #--------------------------------------------------------------------------2 E1 b5 V4 D# `5 a  |  ?5 h
  365.   def return' e' B1 i. C: d; l, z. `2 g
  366.     sion_mouse_return
    , t/ O. [4 D) [8 j0 @) N
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    . h" K7 f# H2 ^9 H
  368.       @scene.instance_of(Scene_Map)
    1 @* t- Q7 |: w' H$ ?/ G
  369.   end
    ; m$ C. v5 a! d/ u1 E+ G
  370. end
    ' ]: k6 d5 o/ ~2 e% ]  y

  371. 0 w7 ]! h7 p) y# A/ h" ^
  372. #==============================================================================
    + P! d1 f; D0 U2 |. D0 z
  373. # ■ Module Input: _1 O5 {# w' n* F
  374. #==============================================================================
    9 W- ]0 s, w! Y# ~. `
  375. class  Input, s0 g: v# e' X& ]
  376.   #--------------------------------------------------------------------------) f% [2 b. e" \0 q! X
  377.   # ● alias
    3 b% D) M1 t: @9 ]0 |5 f$ v
  378.   #--------------------------------------------------------------------------, E0 U; ?- A8 G- B* k8 t
  379.   unless self.method_defined(sion_mouse_update)7 ]2 D& h" W9 S$ `" N6 W; @
  380.     alias_method sion_mouse_update,   update( X3 O' S' w! M( m4 g- L. j! U1 [
  381.     alias_method sion_mouse_press,   press
    " }: A6 s) `4 b  g6 X
  382.     alias_method sion_mouse_trigger, trigger3 R/ Z' ^; D7 f6 H' B
  383.     alias_method sion_mouse_repeat,  repeat" s6 V9 B0 L! q( C6 e7 f! F/ Z
  384.   end
    " Q/ q0 ?4 |% F$ `) B
  385.   #--------------------------------------------------------------------------9 i# l$ i& t% a3 M4 z
  386.   # ● 更新鼠标, }  T. t( @3 p
  387.   #--------------------------------------------------------------------------0 m. K4 B2 u8 v5 E) N' a0 l7 u
  388.   def update
    2 n, o- h& c3 L. a/ y) D) V" k
  389.     Mouse.update
    4 G# s$ L2 T8 M- n8 p: o* ^2 [$ d
  390.     sion_mouse_update0 G2 G# r. e1 m7 G7 }* A
  391.   end
    * d8 e) t$ u" j( x3 S
  392.   #--------------------------------------------------------------------------5 o# l8 m7 M5 a
  393.   # ● 按键被按下就返回true; G3 T% b3 F7 `7 l& i* z0 z& H# ^
  394.   #--------------------------------------------------------------------------& V4 F4 E5 o  L
  395.   def press(key), \& ]) E3 f8 t1 Q
  396.     return true if sion_mouse_press(key)+ G: S& s' ]/ U) t7 i9 Y; c" z
  397.     return Mouse.press(0x01) if key == C
    * a2 a1 s/ O: x# }
  398.     return Mouse.press(0x02) if key == B, F* `6 w) W8 d! M! S0 s, y
  399.     return false4 z+ x& H: [4 k: F
  400.   end
    - }9 _& |7 o* _5 X6 j
  401.   #--------------------------------------------------------------------------
    : G  y& N) Q! ?# K1 y/ t
  402.   # ● 按键刚被按下则返回true
    ; S# H4 W+ `& a$ N4 ]% d0 ]7 |) v
  403.   #--------------------------------------------------------------------------4 m: z- d$ }: G& T% P: ?- j
  404.   def trigger(key)  J( X$ n8 h' f7 S. G
  405.     return true if sion_mouse_trigger(key)& d$ M5 u4 R5 g) F; k3 O& M
  406.     return Mouse.trigger(0x01) if key == C
    + W$ [) M. C! L8 ~5 m1 c
  407.     return Mouse.trigger(0x02) if key == B4 P" K. ^/ J; i' O) V* p
  408.     return false
    4 [! [( Q' V1 Y6 I/ e) ~
  409.   end
    , b: m, H8 [8 E, `8 e6 z' R
  410.   #--------------------------------------------------------------------------
    / i  I( }2 C! F) K2 g+ _
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true$ i$ L7 j1 Z, {2 w( a
  412.   #--------------------------------------------------------------------------" S9 ]% S( |8 U( c, ~/ c
  413.   def repeat(key)" R! g0 R$ r0 M% H3 l6 Q; Y( ?
  414.     return true if sion_mouse_repeat(key)0 s3 C5 U; Q! D. L
  415.     return Mouse.repeat(0x01) if key == C8 l% o* k; ]- ^7 h
  416.     return Mouse.repeat(0x02) if key == B
    % N+ j/ P2 ~; j7 r7 y4 G- F# o
  417.     return false+ k/ e* Y- P5 ~, F  t
  418.   end6 G: w* N& W9 c, H7 _
  419. end4 M2 @; O' n1 V% _! P

  420. ; m/ \( `  k( f6 y5 ]; o
  421. ' K6 D+ E& g7 r6 @7 E
  422. #==============================================================================
    4 x* f: M7 r4 }; J
  423. # ■ Window_Selectable
    6 J7 p" \; k0 ?: p4 u# x/ D9 v6 p& @
  424. #------------------------------------------------------------------------------
    9 K5 p' h7 _. E, ?8 f6 p$ Z, k2 F
  425. #  拥有光标移动、滚动功能的窗口% S; a$ R8 j. N! y8 C
  426. #==============================================================================" t% Z% l* {, v
  427. class Window_Selectable1 k" N; s. W  @3 H3 H2 m: T3 v) _( {
  428.   #--------------------------------------------------------------------------4 `; A! s, L6 L+ ?- y) }; s
  429.   # ● 初始化3 }7 ~  C, F9 ]
  430.   #--------------------------------------------------------------------------
    : c$ B$ _! [5 R; A. P/ p$ r  t$ }+ j
  431.   alias sion_mouse_initialize initialize5 O1 u7 ?- @1 I5 W
  432.   def initialize(x, y, width, height)
    8 W6 Z+ t/ Z" M4 ?9 K
  433.     sion_mouse_initialize(x, y, width, height)
    7 |2 A' C/ v9 ^! G3 e2 o( t
  434.     @move_state = 0- D+ N+ ]2 N1 j
  435.   end
    - [) W# A5 K6 \$ t9 W# J
  436.   #--------------------------------------------------------------------------/ s5 o; m* F- q/ O# u: d
  437.   # ● 更新- I* e3 j. N( W3 f# e$ @/ }
  438.   #--------------------------------------------------------------------------1 }7 T* s* F: j& E
  439.   alias sion_mouse_update update
    : z" v. g/ b4 W$ o0 k* j9 V# C
  440.   def update; Y4 F: J7 J) _
  441.     sion_mouse_update5 l  M$ }) r  I! U
  442.     update_mouse_cursor/ C. h! U: V$ P. M+ c  E
  443.   end" P0 i! t4 f( B
  444.   #--------------------------------------------------------------------------7 L  w# S& P& n! H
  445.   # ● 启动后设置鼠标到index位置
    5 v7 m- t7 p( |: T
  446.   #--------------------------------------------------------------------------4 N6 F6 h6 Q* j$ D9 F2 u
  447.   def activate0 N( Y* s1 x( c2 y
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    2 W3 x$ ?- p, e
  449.     super" F6 R" ^7 {2 W1 ?
  450.   end. @1 q2 l, x5 j# G; s! T$ ^5 ~
  451.   #--------------------------------------------------------------------------/ ]' Q5 ]) U/ \( \3 o
  452.   # ● 更新鼠标和光标的位置7 G6 @3 b) Z8 D7 y" ?
  453.   #--------------------------------------------------------------------------
      w( Q' {( C0 n5 L
  454.   def update_mouse_cursor9 L- W4 m( @9 D$ M2 I! ]
  455.     if active/ R+ ]; M% g& c4 ?% Q4 L9 n" r
  456.       if @need_set_pos
    3 {$ ~7 |4 _9 ^& e
  457.         @need_set_pos = nil7 |% i$ r$ M# @' p+ t  P/ J+ |2 [
  458.         set_mouse_pos  f  l- _) @  i2 m8 q3 w
  459.       elsif cursor_movable
    * z3 ~- A! N9 M
  460.         Input.dir4.zero  set_cursor  set_mouse_pos0 C( t4 C; O" M. A* W- Z( Q
  461.       end
    5 T$ w( o9 g2 N
  462.     end; o# j' X, q' J" T! J) W: d
  463.   end
    4 f' v2 N5 [1 v6 p8 O9 h- d
  464.   #--------------------------------------------------------------------------8 k& k& j3 z! ]7 j  s+ K
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能) T+ R0 R' b+ G+ M4 x8 V# ~! M6 `
  466.   #--------------------------------------------------------------------------1 R5 h7 ]5 Q9 s+ }+ {
  467.   def set_cursor. z3 t0 I( @$ A: c! p- M
  468.     mouse_row, mouse_col = mouse_window_area3 @6 ~: g- E5 v+ u7 j
  469.     if    mouse_row == -1
    $ T+ r& P/ T" @, d1 \$ A
  470.       @move_state += 1 if need_scroll
    3 I! R7 @4 R; `6 p; E2 e$ @6 }; F0 v
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand" o) m3 T0 T* q) C! r$ u4 f
  472.     elsif mouse_row == -2
    7 Y9 C3 z/ @" }3 j7 F$ p' J) g
  473.       @move_state += 1 if need_scroll
    % h6 H% T* G) ]+ z0 E& r
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    ( e5 M- k7 q( t. f
  475.     elsif mouse_col == -1
    6 o$ s! A8 T! ]/ w& K
  476.       @move_state += 1 if need_scroll
    & B9 |1 ^* t1 \
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    7 Y# u  Q# y4 u
  478.     elsif mouse_col == -2
    - o+ j5 V  s+ N3 u* \, A7 @
  479.       @move_state += 1 if need_scroll
    3 `; w: J5 j0 i( d: \8 q
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    0 r- z- Y# V% m" D7 n
  481.     else$ Z* J) [. S4 |$ F. T
  482.       @move_state = 0/ f3 a' I3 m0 Y/ I9 V9 {; @' g
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    $ V" o1 ]2 P% a& W8 F% O2 m
  484.       select(new_index) if new_index  item_max && new_index != @index, H$ }% P- C  k# ]; Z' ^
  485.     end
    $ I; I8 E: q( @, V  z
  486.   end9 @# G. g  S" ]" a7 ^: {( O& {
  487.   #--------------------------------------------------------------------------1 o- B. Z. K$ [4 U1 s/ @
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    7 [9 \$ T" h9 ?; f# V! E
  489.   #--------------------------------------------------------------------------/ _3 Q9 L6 I6 ~2 y- E( m
  490.   def mouse_window_area
    ' G/ j3 x$ U) F3 H" h' Q/ \( ]
  491.     if viewport.nil # necessary!/ ~8 H$ H2 {, j: ~2 l. k# R
  492.       vp_x, vp_y = 0, 0
    ( G4 [- x  \4 {$ ?6 {
  493.     else
    3 D7 ~$ \% f. i5 B0 }9 e
  494.       vp_x = viewport.rect.x - viewport.ox
    9 V  B' @; {( N7 t
  495.       vp_y = viewport.rect.y - viewport.oy
    * _: |$ f( G+ r
  496.     end
    , W4 @2 g1 {2 B/ J
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y# T  l" M% {6 ^! B
  498.     item_x1 = vp_x + x + standard_padding
    2 R( w( m+ ^5 z
  499.     item_y1 = vp_y + y + standard_padding3 n- p' z* ~9 n0 O0 V
  500.     item_x2 = vp_x + x - standard_padding + width9 h/ H6 Z! C, O3 r: h- o
  501.     item_y2 = vp_y + y - standard_padding + height2 c# H4 F. X: x4 j% l
  502.     if mouse_x  item_x1
    ; n) a; l1 u  t% M# n
  503.       mouse_col = -1( F: E+ c6 ^; X5 y' a# W' H/ T
  504.     elsif mouse_x  item_x2& q4 ]" T7 n+ }8 W$ _$ j
  505.       mouse_col = -2
    $ p/ F' B/ M& f+ y. w
  506.     else
    - _; o7 O5 |/ x: r) \3 o" m
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)7 f& g+ M- s) ~4 f
  508.     end5 I) Y- H- }1 h4 ?/ V
  509.     if mouse_y  item_y1
    + W* c3 e! X. j2 n) e
  510.       mouse_row = -12 b' x/ R. m5 w1 d2 s
  511.     elsif mouse_y  item_y2* v& n2 W! f, z- F1 y  k
  512.       mouse_row = -2
    3 q+ x+ s7 P  z) B6 M
  513.     else
    # S- H1 Y+ E2 T$ X1 W9 s) _2 ^$ {4 I" U
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    4 K4 T! o/ `0 ?3 m' e% F, v
  515.     end
    ) o0 U+ A# y2 a0 o
  516.     return mouse_row, mouse_col  G; e% U! P$ Q7 e! y
  517.   end
    , m2 l! M( I* o
  518.   #--------------------------------------------------------------------------
    " |+ c& b5 e' |& P1 e+ @
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    8 M9 U0 I- p( k( Z/ e) J6 E9 X
  520.   #--------------------------------------------------------------------------' t6 w, J7 C6 m0 u) D, {
  521.   def set_mouse_pos+ `5 w( c* F, w- d7 M+ Z
  522.     if viewport.nil # necessary!
    ; S$ i* |, P- O) L6 ^4 I
  523.       vp_x, vp_y = 0, 0
    # R: c; ]! H4 T5 x1 |
  524.     else
    8 J# W3 S' W, a5 v- k2 t) s! X
  525.       vp_x = viewport.rect.x - viewport.ox
    : _& p: j6 }2 P. P  y1 z9 `
  526.       vp_y = viewport.rect.y - viewport.oy) V* X+ @% T7 ]# Y- E
  527.     end
    ' T( G1 q( f! e9 q# k. Z
  528.     item_x1 = vp_x + x + standard_padding
    & t( e# [+ d' j1 E
  529.     item_y1 = vp_y + y + standard_padding
    5 S: W' Q2 j+ A% t- [/ H% c* c
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    - l! Q0 R; [, I% J  E  P
  531.     row = get_index  col_max - top_row
      m- K; u( a1 U% Q9 N$ c
  532.     col = get_index % col_max+ b$ ?6 i5 i7 j8 d5 J1 \
  533.     new_x = item_x1 + item_width  (col + 0.5)
    * a1 O% v& E- a' r- _
  534.     new_y = item_y1 + item_height  (row + 0.5)
    4 E* i8 W' q' D9 T" J; K
  535.     Mouse.set_mouse_pos(new_x, new_y)
    2 p3 m) K8 Z' z
  536.   end
    6 `  q! L. h0 k7 [
  537.   #--------------------------------------------------------------------------( m. V$ ~# r) ^! @, V% N: E3 _
  538.   # ● 判断菜单是否需要卷动
    7 F. N* J8 b( Z/ \) s
  539.   #--------------------------------------------------------------------------1 ?" P, r8 y& I, H
  540.   def need_scroll: Z& x% [0 B' R) _
  541.     item_max  col_max  page_row_max  Z5 y) ]( j- |: C
  542.   end9 d6 N3 Z$ k" h) y
  543.   #--------------------------------------------------------------------------
    1 ~; J7 v8 W: y5 E- f: I6 e+ a4 u
  544.   # ● 判断是否为水平卷动菜单
    " n, R$ K- g" m: n% g4 ^
  545.   #--------------------------------------------------------------------------( z! y3 a, B1 A* D7 J
  546.   def is_horzcommand
    % Q4 C$ V7 n  U0 T
  547.     return false& c, y% I# j! O0 |
  548.   end
      X: o+ J3 O( M3 H
  549. end+ |% y1 l6 J) w& F: H/ Y6 }- R, ~
  550. ' W& \* e4 h8 [$ |$ U, R8 ^2 D
  551. class Window_HorzCommand
      f2 q$ P6 q' u4 y9 ^3 Q7 {, [' G
  552.   #--------------------------------------------------------------------------  F( z9 c6 X" b2 v; t
  553.   # ● 判断是否为水平卷动菜单# y6 Y2 {$ y7 w7 H" U5 I" I
  554.   #--------------------------------------------------------------------------
    9 }6 l1 x5 D. R
  555.   def is_horzcommand
    0 T. D0 Y# @' m% z
  556.     return true; K0 y0 V# ~9 y6 A3 n7 A: _6 a" N+ A5 ^
  557.   end
    3 P- Z1 H9 j3 L8 c
  558. end' b3 c/ u2 y1 G! R+ F
  559. 7 F- }3 A4 L5 |+ {! J
  560. #==============================================================================9 Z' x) d, \( ~' K9 F
  561. # ■ Window_NameInput* q- p! _  u- n* Y5 ~
  562. #------------------------------------------------------------------------------( m- j+ Y+ m! X8 ?- x
  563. #  名字输入画面中,选择文字的窗口。
    : @+ j- m4 h: C
  564. #==============================================================================0 o" A( {( ~% L$ W4 g( u* ~6 }
  565. class Window_NameInput$ Y; e. L; b: O" T" s! P+ U1 q
  566.   #--------------------------------------------------------------------------: v- V0 M0 m- [8 c! G/ @/ V
  567.   # ● 设置列数
    5 E! U, h( U) u3 h& ^* A/ o
  568.   #--------------------------------------------------------------------------
    * |+ R4 N* E& p+ W1 Y
  569.   def col_max$ G4 S) }; q" t! }5 a! C% F2 c
  570.     return 101 V9 D3 f- |; _
  571.   end2 a; c) u+ d  S% l! Z
  572.   #--------------------------------------------------------------------------
    ( r' V' `$ ]! l$ A( k0 H
  573.   # ● 设置填充的Item个数
    3 p0 X4 q+ r8 ]1 e1 e+ C% Y
  574.   #--------------------------------------------------------------------------7 r5 e. h! L" y1 T; @
  575.   def item_max
    3 F# L, P7 m6 W8 q, K
  576.     return 905 G* i  ^: w& q0 f
  577.   end7 g# e0 |: y9 M, @
  578.   #--------------------------------------------------------------------------1 Z" o( N1 `, d+ w8 s  x# H
  579.   # ● 设置填充的Item个数  A9 ?1 m0 h6 i( e& n7 H
  580.   #--------------------------------------------------------------------------
    - H9 {* V6 H' u5 w
  581.   def item_width
    8 ?& x" k4 k, T3 O) E
  582.     return 32; D9 m' z& W: U9 n) q
  583.   end  \  {0 e" q% `/ S  u
  584.   #--------------------------------------------------------------------------
    ) \7 x) l- C( C% B& ~8 ], v. z
  585.   # ● 判断鼠标位于菜单的第几行、第几列; V& ~) t! `) \8 U
  586.   #--------------------------------------------------------------------------
    4 b2 m0 V; F, f' a1 u1 `; c
  587.   def mouse_window_area  }& H2 C0 m( w- L( p
  588.     if viewport.nil( @2 Z8 e& `* k% l# j( {& O; F
  589.       vp_x, vp_y = 0, 07 z  K9 d/ P7 H# @
  590.     else
    / Q- y# J) A4 a: [2 L+ w% ]
  591.       vp_x = viewport.rect.x - viewport.ox1 Q1 ^9 t9 N" P, K) [
  592.       vp_y = viewport.rect.y - viewport.oy& S5 t; l# n& F. e" n4 S
  593.     end
    # P* v4 l& q& v- D. Z
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    $ O( E- c  H, z  v$ o& A
  595.     item_x1 = vp_x + x + standard_padding
    8 \& f6 _* R2 E- z) k
  596.     item_y1 = vp_y + y + standard_padding; A1 R7 x' g$ r
  597.     item_x2 = vp_x + x - standard_padding + width$ y6 T1 e% j/ J3 z) U
  598.     item_y2 = vp_y + y - standard_padding + height
    9 K) J% f, @1 \; l( n
  599.     if mouse_x  item_x1* o9 G5 }/ e6 b) v
  600.       mouse_col = -1
    ' u$ Z/ a: _! e/ s
  601.     elsif mouse_x  item_x2, f$ M! `0 q. L: b& f6 w6 N6 R. ~2 I
  602.       mouse_col = -2
    ! ?- g; B- a0 ^# B. F7 h
  603.     elsif mouse_x  item_x1 + 160: D# m( b* z6 H) I9 d
  604.       mouse_col = (mouse_x - item_x1)322 J% y; f( S3 z. v' N/ i9 T
  605.     elsif mouse_x  item_x2 - 160
    + S2 Q1 H, H2 W( [+ m3 G1 N2 k
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    ) u1 R7 s7 p, L  E. d0 ?
  607.     else+ U7 T" r% I. X8 E
  608.       mouse_col = mouse_x  x + width2  5  4
    2 F/ F! @( W8 T# Q, a# k  K
  609.     end7 c+ b+ J# d  G: W
  610.     if mouse_y  item_y17 H3 U% T) X, k' B/ }7 A' E1 _; V- U) G
  611.       mouse_row = -11 t2 `. h2 [( G, m1 F3 N  l
  612.     elsif mouse_y  item_y2
    * w' |+ w% N- P6 w  f
  613.       mouse_row = -2
    2 V' N  A- d9 q( y3 h  K  Y
  614.     else2 E9 s0 }" @$ S+ G8 U0 T+ _4 ?
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    ( N2 U7 f; Y% v& {5 V+ e- @
  616.     end5 n6 t0 C7 q7 z. t  e3 o: @
  617.     return mouse_row, mouse_col
    - y( U5 h( {" G: s" W
  618.   end
    # ^) k/ U: z; _& ^! |3 b% v
  619.   #--------------------------------------------------------------------------& W- q. [5 M1 x, V: S& R
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
      P; X2 S* n  ~  r. D
  621.   #--------------------------------------------------------------------------
    / x: Y) G, X2 ^1 n7 w' g
  622.   def set_mouse_pos8 m) x4 [: J7 d% h+ c
  623.     if viewport.nil # necessary!
    1 v# |8 G$ A8 C
  624.       vp_x, vp_y = 0, 0# N! m5 P/ v/ i3 G
  625.     else/ v- c$ r. F# \
  626.       vp_x = viewport.rect.x - viewport.ox
    4 C3 U" x* {- z- A! [; ?
  627.       vp_y = viewport.rect.y - viewport.oy
    ( n* @8 R8 \5 Y2 Q9 w) ]
  628.     end
    ; r! X+ \4 `5 s" Y  Y( {
  629.     item_x1 = vp_x + x + standard_padding 7 p1 [. d  Q. ]6 w% T% E
  630.     item_y1 = vp_y + y + standard_padding
    1 W+ X8 L' D. y( c
  631.     get_index = @index  0  0  @index
    2 ?$ d9 e) |! `
  632.     row = get_index  col_max - top_row
    ; c# G3 w" b, X. k5 v
  633.     col = get_index % col_max5 }* O( s" C9 ?4 n
  634.     new_x = item_x1 + item_width  (col + 0.5)  C" F0 }1 W8 N
  635.     new_y = item_y1 + item_height  (row + 0.5)3 L" S0 T5 \. f4 W7 U4 o& K
  636.     new_x += 14 if col  4
    6 H9 N4 P4 f: q: A& X  c
  637.     Mouse.set_mouse_pos(new_x, new_y)' n6 ~9 m# y& g0 ?1 @
  638.   end9 n4 f+ z! F" w8 r) Z. ]
  639. end
    - W: x1 I" h$ ?! T) }0 P# j, ~
  640. 2 H6 }# D0 N5 m* K  B( p6 j* w
  641. #==============================================================================
    * u4 r1 t  S# m$ @# }
  642. # ■ Window_NumberInput
      J7 |9 U4 ~$ A( g# R  ?, A
  643. #------------------------------------------------------------------------------( `5 E" W0 t3 a- H9 {& Z+ T5 U$ w
  644. #  重写了数值输入的方法以适应鼠标7 f( f4 ]0 ?6 \3 J4 D2 D
  645. #==============================================================================
    / G$ S( \7 C8 h5 C
  646. class Window_NumberInput  Window_Base) Z1 t: z& L$ c4 s2 L! t! r
  647.   #--------------------------------------------------------------------------
    " T, Z7 M! d9 R+ m" ?
  648.   # ● 定义实例变量- R7 u1 J' _* b4 P; E6 S
  649.   #--------------------------------------------------------------------------
    - I! X9 f  @/ T/ n
  650.   attr_reader extra_window8 y- ]  q" P" u" @' m2 z2 b8 W
  651.   #--------------------------------------------------------------------------
    0 s+ Y0 d8 C9 a6 D- J5 \/ n! k% Z
  652.   # ● 初始化% \$ J3 H; _" J
  653.   #--------------------------------------------------------------------------
    : H+ N& W& N+ i$ d
  654.   alias sion_mouse_initialize initialize
    ! Y7 k% j( ~! Z. o1 |
  655.   def initialize(arg)
    0 M( H, q; ^5 F" @8 n
  656.     sion_mouse_initialize(arg)1 }% ?3 h7 f# x  ^
  657.     create_extra_window5 r7 ]$ Y. S6 ]  t; x+ O  h5 w$ G
  658.   end  `* d1 n+ v" p! L) h! I  }: k2 P
  659.   #--------------------------------------------------------------------------
    # f( G: }% x: ^" n8 @
  660.   # ● 启动+ t- j. n- }3 u
  661.   #--------------------------------------------------------------------------7 _! r: Y+ u4 z( v- c- P! E/ E5 C
  662.   alias sion_mouse_start start
    : F1 t/ G2 C& @9 r
  663.   def start; A! T! q6 W0 f' v- x+ h& Q+ }% K
  664.     sion_mouse_start7 @' J6 w$ R; p3 Y* q9 t0 a" j
  665.     deactivate
    ) o) O* _+ r: j/ d% g6 y& ~
  666.     extra_start9 k* N- e/ a7 J+ f6 ^/ L" y9 U
  667.   end
    1 z! T+ e. V- }4 Z+ z
  668.   #--------------------------------------------------------------------------
    / z# f( ~- X( T, A' h* U# q" T
  669.   # ● 创建新的数值输入窗口
    ) P: m0 A. ^- G
  670.   #--------------------------------------------------------------------------
    ! _+ [; Z* g" {; V2 y3 b2 Z
  671.   def create_extra_window
    6 S) O0 F4 q% [9 A: I
  672.     @extra_window = Window_NumberInput_Ex.new
    ' g2 `& V; F! |$ q& p% `
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2* x  M9 R& `/ l5 Y7 q0 ]( e
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }( u( z: O# [: [
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    # t  S' {9 g" J( p/ A2 H0 g$ m$ p5 e
  676.     @extra_window.close_proc   = Proc.new { close }
    5 y! ?% q8 M7 E  V  O: N
  677.     @extra_window.refresh_proc = Proc.new { refresh }8 E, d+ T! c6 N/ d% ^
  678.   end
    , A2 D1 d. @% p1 Q! E, p/ @
  679.   #--------------------------------------------------------------------------
      K# W; h) }$ h% X
  680.   # ● 激活新窗口
    * P6 D( m% M# M+ ^3 i& A% P
  681.   #--------------------------------------------------------------------------
    ! r3 K+ c/ B7 W' W1 v
  682.   def extra_start) C! R1 m' Z! }
  683.     case $game_message.position# T, \, ^+ d  R/ t% o
  684.       when 0; @extra_window.y = y + height + 4# r$ z+ A3 g+ ?  M: G* i5 J4 x2 z! C& G
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    0 C: D# m! N  `) [
  686.       when 2; @extra_window.y = y - @extra_window.height - 40 O$ b0 q" _$ Y% n- p
  687.       else  ; @extra_window.y = 8% C8 A! m- b* ?7 Q: T8 R9 l0 z
  688.     end
    9 R* p6 Y+ i# q! S5 }# g
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    ( A' |, T2 W9 B
  690.     @extra_window.digits_max  = @digits_max
      |) j: _2 r2 i
  691.     @extra_window.number      = @number+ Q" b+ ^3 ~0 B/ e$ J$ W
  692.     @extra_window.open) o) R5 X7 q- A- E$ z/ R+ k
  693.     @extra_window.activate
    , e; g% C  `( Q& e. k2 T$ u! [
  694.   end* I. n7 k7 }% O1 S( [9 g& w
  695.   #--------------------------------------------------------------------------
    4 ^) R1 W2 Z& |; I
  696.   # ● 更新! g: U: r, e9 k  a5 ^
  697.   #--------------------------------------------------------------------------
    / o. ?9 [3 T" y- V* x
  698.   def update
    9 g# ~; H, ]; ]+ V5 ~3 L( U5 t
  699.     super
    - y- Q) G8 [0 Y  W+ D
  700.     @extra_window.update6 s4 R5 b+ `' R2 g. p2 F2 ?$ y
  701.     update_cursor
    1 x& I4 [2 O, r; V
  702.   end$ c' x0 U( [0 ~! ]" e0 R4 J! k
  703.   #--------------------------------------------------------------------------! y2 n% N- E9 z! Q& z8 S" e! z# O* Z
  704.   # ● 关闭窗口
    ! |3 J# [' z0 @, ~) C9 |
  705.   #--------------------------------------------------------------------------
    7 z, S+ C8 S8 J% T
  706.   def close# q( E, B% G2 A8 H( k' j- w
  707.     super( C; v$ U/ @  b9 g) Q4 j2 x& J
  708.     @extra_window.close  _7 z  T: ~# Y8 V8 X) e) c& z
  709.     @extra_window.deactivate- C, P/ I( j- p: |
  710.   end. U' t( z. g) n) H$ C
  711. end
    ' i* B5 z, U4 v: [* S

  712. / ~8 U3 l$ e5 j$ g9 Y; h( N' L  r
  713. #==============================================================================
    / k4 j% c8 E1 s( K6 z* J' I
  714. # ■ Window_NumberInput_Ex
    6 W% }1 [$ L1 D4 N
  715. #------------------------------------------------------------------------------
    . _4 G+ O6 L/ O" `! v
  716. #  新的数值输入窗口(NewClass)
    - j5 r/ w- q5 Q# G8 A' c
  717. #==============================================================================
    / _( a# y4 R: J. b( R, q
  718. class Window_NumberInput_Ex  Window_Selectable! b2 f  X, I0 g2 S& T, G6 ?
  719.   #--------------------------------------------------------------------------
    " L3 o0 E) C3 f
  720.   # ● 定义实例变量* u2 p# v9 Q* p+ e2 J+ ~3 ~6 D* R
  721.   #--------------------------------------------------------------------------
    ! s4 c$ ]2 h, }
  722.   attr_accessor number_proc0 g" K0 r5 d3 ~$ f
  723.   attr_accessor index_proc& x8 u- e' M+ T' s
  724.   attr_accessor close_proc$ X6 Z! I$ y& V/ }1 R6 Y- K
  725.   attr_accessor refresh_proc
    " g& Q8 r9 a' O$ @$ Q9 I$ |
  726.   attr_accessor number$ F0 g9 ?3 w" P
  727.   attr_accessor digits_max
    ( _* x5 b0 b$ A& H1 p3 H, k
  728.   attr_accessor variable_id1 i& |$ \& l9 r% P- T
  729.   #--------------------------------------------------------------------------' @3 O' j9 l9 h8 E* a' L# ?, r
  730.   # ● 数字表
    ' b& C8 s; v6 i2 G
  731.   #--------------------------------------------------------------------------; _4 G" N4 _8 s% h7 p# {4 }% A7 n
  732.   TABLE = [  7,  8,  9,
    2 C& S, _, {& v0 O: y. z+ r
  733.              4,  5,  6,4 C% |% ~* L3 ~$ T" \; N
  734.              1,  2,  3,- F" r+ B8 S7 I$ p3 x4 E6 t
  735.             '←',0,'确定',]
      u! z4 ]) X$ o' N+ n( ~
  736.   #--------------------------------------------------------------------------6 K2 r* W" E+ r7 r
  737.   # ● 初始化对象. S9 ^1 o  h: R$ a$ [; Y
  738.   #--------------------------------------------------------------------------- y6 e, o; `& @1 x
  739.   def initialize5 j& t- O& P2 ]; s1 ]5 [% _
  740.     super(0, 0, 120, fitting_height(4))
    - M' A( g& L% Q6 j4 U- `! T0 ?
  741.     self.openness = 0
    - I& i. d$ ]3 s( y5 B
  742.     @index = 07 n4 S8 |8 n8 L6 J8 K* q
  743.     @number = 0
    8 c8 F* ?% s+ P5 J8 C
  744.     @old_window_index = 0
    7 t3 O  b/ t1 c1 N
  745.     @digits_max = 0
    ( s4 |# x8 x+ }. e& o% z
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    : X3 e4 ^. [: r8 W/ L, k% ?
  747.   end
    % Q/ v  L6 I2 w& _  W
  748.   #--------------------------------------------------------------------------& h0 g! l5 N, K5 M
  749.   # ● 获取项目的绘制矩形! f8 d$ C1 ]' E+ @, k% H
  750.   #--------------------------------------------------------------------------/ t+ f/ z" C% E1 `
  751.   def item_rect(index)& @' d0 y7 `2 l8 t
  752.     rect = Rect.new
    . |2 {, x) j0 U0 b8 V: C
  753.     rect.x = index % 3  32
    8 T- z. [& K- ?2 B) O
  754.     rect.y = index  3  line_height/ F: T1 _/ j: T2 q& g7 y
  755.     rect.width = 32
    + g# E( p6 W3 k, o0 @
  756.     rect.height = line_height
    . t) V3 t; [$ C) g
  757.     return rect7 e4 P$ @! v/ i& z- ^+ G
  758.   end3 V+ @- S- J: H7 p* [
  759.   #--------------------------------------------------------------------------
    " `& \- l& I9 F. v$ [2 V
  760.   # ● 将光标设置到鼠标所在的位置
      j' r+ ]! W0 g* d2 A
  761.   #--------------------------------------------------------------------------7 h0 a+ G- p1 k  Z  ^
  762.   def set_cursor) w4 g" `: z; J( [
  763.     mouse_row, mouse_col = mouse_window_area6 [* U2 d& d# h: [$ M% i; r
  764.     if mouse_row = 0 && mouse_col = 0
    " M$ X9 h3 B$ g( ]& Y
  765.       new_index = mouse_row  3 + mouse_col. H( ]# j' p( w( P
  766.       select(new_index) if new_index = 11
    ( u9 R5 O2 H+ T. D
  767.     end4 e5 Y' M, Y% a$ R0 V# U2 _* _
  768.   end
    7 r7 s" M# W/ ~' Q
  769.   #--------------------------------------------------------------------------
    # S/ D0 f2 Z0 ]  S
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    : ^- `5 S9 o" q) I
  771.   #--------------------------------------------------------------------------
    9 F- z" {1 {) ]
  772.   def mouse_window_area( ~+ k" j  G" Y
  773.     if viewport.nil9 G8 b6 a8 c) k) F+ K
  774.       vp_x, vp_y = 0, 0* C; ^8 h+ C3 k  L
  775.     else
    . p$ ]; t$ ^0 T6 ^% N: `9 E5 {( p2 t
  776.       vp_x = viewport.rect.x - viewport.ox, r2 ^1 |6 _2 L8 S4 f( d
  777.       vp_y = viewport.rect.y - viewport.oy
    0 y" J( F% K$ Q
  778.     end1 ^. D8 }! [$ l3 `/ r2 Q
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y3 Y6 T! P2 U" l; m% o
  780.     item_x1 = vp_x + x + standard_padding
    8 E; j. `$ n) F% Q
  781.     item_y1 = vp_y + y + standard_padding
    : L% B. ]: S& F
  782.     item_x2 = vp_x + x - standard_padding + width
    & g4 k" T- j1 g! _& D& N0 w/ z: k# e2 }7 {
  783.     item_y2 = vp_y + y - standard_padding + height9 C- }/ U# |/ x% ~" b1 G
  784.     if mouse_x  item_x1
    3 v9 g7 h" z% x1 u6 W0 s
  785.       mouse_col = -1
    ; w. T2 ?" q1 @0 I
  786.     elsif mouse_x  item_x2
    8 E# [1 w2 g7 D, z9 P
  787.       mouse_col = -2& K( b7 w4 |$ G, J7 D; X
  788.     else
    " u- H' B2 P, _, g8 y; I% I) j- H" N
  789.       mouse_col = (mouse_x - item_x1)  32
    : V' }6 _% O8 Q7 E& E
  790.     end3 u& c% j' c2 h' p$ k. N- y6 K
  791.     if mouse_y  item_y18 x, Z& X& X8 e- ^
  792.       mouse_row = -1' Z7 c. P" E% e4 M4 u
  793.     elsif mouse_y  item_y2
    7 v5 r' N+ p8 J- N
  794.       mouse_row = -2
    - _! f, Q$ ^0 w. h( K3 B3 F7 w
  795.     else
    ! L8 e; R6 o/ Y% j+ f) n. R
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)* |$ ^( B7 q/ n) B
  797.     end1 T0 _( s- z8 P
  798.     return mouse_row, mouse_col
    9 d4 {; q3 {% i$ \3 ~/ k0 Y) _
  799.   end( }( ^% }4 S3 j2 l: |+ l" [3 Y
  800.   #--------------------------------------------------------------------------# {0 H! O$ h0 p' @& p
  801.   # ● 获取文字
    + ~5 P6 w' o! C$ Q8 p) f7 j
  802.   #--------------------------------------------------------------------------  [2 [5 W; N* h& E
  803.   def get_number6 J! a1 I! u( R9 X" q+ d& F3 h" M
  804.     return false if @index == 9  @index == 118 {* }' u+ ~9 V$ e& U% |$ F
  805.     return TABLE[@index]' _" u8 d6 U9 p0 j2 B
  806.   end
    2 H; p7 ?. f) U" ^0 ^" d
  807.   #--------------------------------------------------------------------------
    / e9 w8 \3 |& }! [; E9 @
  808.   # ● 判定光标位置是否在“退格”上
    % z. _1 N5 U% v8 t/ a3 s" p
  809.   #--------------------------------------------------------------------------/ {6 T0 E1 q& l) A$ N) m# b2 E8 N
  810.   def is_delete# x/ F8 x% {: K( U2 E
  811.     @index == 9- S3 x: g! T" |: \" ]. m
  812.   end
    * M& c0 M) C4 H  C
  813.   #--------------------------------------------------------------------------
    9 R# q1 R: U3 R3 f
  814.   # ● 判定光标位置是否在“确定”上- e1 z! |# I; ]4 T
  815.   #--------------------------------------------------------------------------
    9 p7 Q" `7 ?, Z# r( T
  816.   def is_ok" y* J9 V. s3 P/ G1 |
  817.     @index == 11
    2 N1 e( D* k7 w, c& r
  818.   end
    5 f: T6 V0 M: u' J# r) ], L
  819.   #--------------------------------------------------------------------------4 S/ ^% ~' @6 d5 [
  820.   # ● 更新光标
    # g( H" K' _- a# W1 b
  821.   #--------------------------------------------------------------------------
    ! i& e: {: i% V  ?" q7 N* Z
  822.   def update_cursor
    ) y. l0 ^  p6 g* J
  823.     cursor_rect.set(item_rect(@index))
    & S% T( ]5 v, q# H6 y  Q, x' r( r
  824.   end" M) e+ ~  Q" w$ M  W! o
  825.   #--------------------------------------------------------------------------
    * U5 d2 V4 [$ Y: F5 O
  826.   # ● 判定光标是否可以移动8 ?+ b6 G! H* y: a7 _/ A
  827.   #--------------------------------------------------------------------------0 o) o  T7 y1 G% w% r
  828.   def cursor_movable
    % G1 ^& L8 Y- s2 k
  829.     active4 l7 {8 Y7 E( K3 @+ v8 i
  830.   end
    % i/ X7 x1 y$ j9 y' w! r  ]( i9 N
  831.   #--------------------------------------------------------------------------+ `. v0 A9 R. f; t4 S' `
  832.   # ● 光标向下移动) R* Q) E! H2 X2 m/ E$ V4 \
  833.   #     wrap  允许循环
    ! D/ v  S$ D# q- L7 R
  834.   #--------------------------------------------------------------------------
    5 l! s0 w4 o( p2 {6 M
  835.   def cursor_down(wrap)' F+ e; t1 W0 U; e  d1 T
  836.     if @index  9 or wrap# e" p' b( C; C1 B
  837.       @index = (index + 3) % 12
    9 {. w" c: o& u9 |7 ^5 q. m* ^
  838.     end1 ~0 C$ t% o0 L
  839.   end
    8 n- I3 A, Y! t2 F' s( U% S- J
  840.   #--------------------------------------------------------------------------
    3 K: P" }. l3 e& e0 {
  841.   # ● 光标向上移动
    ; [' n1 J3 u3 A5 E* I
  842.   #     wrap  允许循环2 Y" L. Y) O6 \' v- }$ r
  843.   #--------------------------------------------------------------------------) W) ]' l2 j& ]  m% s
  844.   def cursor_up(wrap); k/ u+ j# t! z" l" z
  845.     if @index = 3 or wrap
    * N9 Q- r  e! L  J- M
  846.       @index = (index + 9) % 12
    - q" ^9 X3 `5 H7 k; P
  847.     end
    6 a+ t/ @. _9 u& }$ V
  848.   end8 P4 K$ E1 t/ j9 _/ \
  849.   #--------------------------------------------------------------------------
    8 _) |) B' |# ?, ]) W
  850.   # ● 光标向右移动
    * L: p% D8 U' P- e; L3 e" c0 Z6 U
  851.   #     wrap  允许循环
    ) S: n7 f; ^/ b$ Z8 \, L+ S- K; L
  852.   #--------------------------------------------------------------------------
    3 K0 c% i9 h/ `- O
  853.   def cursor_right(wrap)
    + D6 ?2 g1 N1 `5 b* T$ A: ]
  854.     if @index % 3  2
    5 R6 T/ G( m0 z( H8 z# i
  855.       @index += 19 x" w$ j' J$ O
  856.     elsif wrap
    % o* t$ \3 x$ |9 ~* v% `% [
  857.       @index -= 2
    8 q! Z4 \; O. `  ~9 N1 G3 q
  858.     end- c% h+ M- s; {' W9 r* z
  859.   end0 s' G4 X1 ?- _* ?
  860.   #--------------------------------------------------------------------------
    7 n, ^. b4 W- e! J  U4 E% l
  861.   # ● 光标向左移动
    7 g7 r/ B# m+ F/ t
  862.   #     wrap  允许循环
    / D6 W* `2 [2 g* v- f# _/ k  ?5 ~
  863.   #--------------------------------------------------------------------------3 q; b/ P! o8 |
  864.   def cursor_left(wrap)
    % S$ O; ~; J) [! a/ b9 U
  865.     if @index % 3  0, u% G8 a& t. P
  866.       @index -= 19 {% z9 f# U/ ]5 Z9 w' A
  867.     elsif wrap) F- K3 a: Z5 C$ C7 S; V: j8 T1 v
  868.       @index += 2. h3 v  H! ^+ |$ e3 U' x8 d! M
  869.     end
    ( P4 Y7 |, F7 {+ ?8 N
  870.   end1 ]$ {3 |" b1 e- ?& ]! }! H
  871.   #--------------------------------------------------------------------------, z* P$ z) O; d' @  Z
  872.   # ● 处理光标的移动* Y. c$ E7 J& f
  873.   #--------------------------------------------------------------------------9 a5 y; G" T9 v# t( ?
  874.   def process_cursor_move
    ) B2 }* A/ a- ~
  875.     super
    , K7 k% O9 z/ T3 q" e) A
  876.     update_cursor
    7 m$ c3 I& g6 g% a; t3 g
  877.   end) o4 m5 v! X1 C8 n6 W- _% _2 {
  878.   #--------------------------------------------------------------------------
    $ t3 P: A5 M4 a; E2 k7 V
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    4 W( B& x2 j6 K& ^9 v7 `# B2 W4 F
  880.   #--------------------------------------------------------------------------) N# e9 h! ~- n) S; L+ j3 Q
  881.   def process_handling
    ' W" ?, _/ m4 a5 F  o! n, m7 Z
  882.     return unless open && active9 K' |4 F6 Q8 `4 J. ~( I1 H6 f& q! F
  883.     process_jump if Input.trigger(A)
    3 p$ D: n6 f; S0 O" ?
  884.     process_back if Input.repeat(B)
      ]$ q3 c6 ^+ R% r" s
  885.     process_ok   if Input.trigger(C). `2 r6 f0 R/ i
  886.   end: Y& F; p2 n2 S0 ?$ f' _9 z2 u# b/ C0 [
  887.   #--------------------------------------------------------------------------, v9 s8 O+ t/ O( o
  888.   # ● 跳转“确定”. A) O. G0 I8 @5 ^/ N. r( `! Z9 c5 P
  889.   #--------------------------------------------------------------------------' m  p$ y& z, H& \
  890.   def process_jump8 G# d- Q7 `: m2 `
  891.     if @index != 11
    # g3 m; ]1 y( Z- z) ]2 a
  892.       @index = 11
      ?( n9 `- ~% u! g* d
  893.       Sound.play_cursor6 L$ o0 z  g$ V& N6 K. ^) }& L% P
  894.     end
    . }& M- S7 o' N: W3 \/ G
  895.   end, M) u  B. ^, z3 y: s$ M: K
  896.   #--------------------------------------------------------------------------6 T" x8 m) n  \( k/ K% A
  897.   # ● 后退一个字符
    7 I8 g$ a6 ]4 J+ c
  898.   #--------------------------------------------------------------------------. }+ Y7 q+ V) T0 y
  899.   def process_back# ^3 M1 D  e' ~5 p0 s- l$ g
  900.     Sound.play_cancel
    4 n* ]+ ]  H- @! \2 h
  901.     place = 10  (@digits_max - 1 - @old_window_index)# {2 a+ n/ c! Y$ h
  902.     n = (@number  place) % 10' J  u& F6 l  N) |5 O
  903.     @number -= n  place
    , \2 D+ f+ T& ^: _
  904.     @number_proc.call(@number)
    % I0 V0 O  l8 P
  905.     @old_window_index -= 1 if @old_window_index  0) V$ T1 T% g9 I6 U* d
  906.     @index_proc.call(@old_window_index)% b. H8 ^  N" c. y0 z& p
  907.     @refresh_proc.call
    ; T  R9 J6 z$ X  O7 u# \
  908.   end8 k! W1 C# n& P1 F9 u9 C( O
  909.   #--------------------------------------------------------------------------# n: p$ w' F" [: j# Y. K% m
  910.   # ● 按下确定键时的处理& J$ m( C) ~8 `" i0 _  G
  911.   #--------------------------------------------------------------------------' A/ J) a6 C) i; A! e
  912.   def process_ok
    8 ~$ }1 o# D2 a: j& H
  913.     if get_number2 N2 z: t, K6 j- p1 n; g0 r
  914.       Sound.play_cursor4 [- l: p# A/ k: [) T
  915.       place = 10  (@digits_max - 1 - @old_window_index)7 U9 c+ i( p( S, s) b* {! P
  916.       n = get_number - (@number  place) % 10) c( @* q9 m. K' P
  917.       @number += n  place5 q8 H& L; l  y: k4 A# M
  918.       @number_proc.call(@number)
    1 l4 P7 Q% Q- ]! I
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    ) l- x8 K  V4 B5 i7 U% h3 D
  920.       @index_proc.call(@old_window_index)
    ) b" T/ ^. ]. L
  921.       @refresh_proc.call
    ) ~2 f5 _5 ?) h) K. z4 b: E2 E4 Z% U
  922.     elsif is_delete1 `9 x7 L, l8 {4 q2 F
  923.       process_back' W8 o* z4 Y- |+ A% @* C, X% e
  924.     elsif is_ok+ ~7 L" `9 K1 k9 `; _) `1 D
  925.       on_input_ok
    0 `/ j5 ~6 J  l6 u4 ]2 T% h2 j1 M
  926.     end+ Z8 W# V" p" y1 s8 \/ h0 y8 n* K
  927.   end
    " T: g( N' K% S/ {
  928.   #--------------------------------------------------------------------------1 [) y) A; Y3 D" y
  929.   # ● 确定
    . j  v/ B; n. K7 n& [
  930.   #--------------------------------------------------------------------------; ]* l& w: ~- J# r0 f
  931.   def on_input_ok
    4 g7 W. E7 Z' }' L, p' j
  932.     @index = 0
    ( W/ s  p* s) E4 @
  933.     @old_window_index = 0* C) X+ y( @: o9 o9 Z$ ~* U
  934.     $game_variables[@variable_id] = @number* T" H8 g4 \& E2 Y
  935.     Sound.play_ok
    , B( Y9 m% A, J$ B8 x
  936.     @close_proc.call
    ' J& a4 m" N+ N) J
  937.   end5 U5 T' |9 j& ?8 v( f" u- E# L
  938.   #--------------------------------------------------------------------------, _- ^2 H3 ?2 s. I
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ( ~: ?/ z( V6 C& @8 Z4 E3 M
  940.   #--------------------------------------------------------------------------
    + D. q  g8 q" e  [" G3 Y
  941.   def set_mouse_pos) ?, O9 p1 u8 n( U+ T
  942.     if viewport.nil # necessary!
    4 N" Y- A- Z$ p3 d; i1 i9 p
  943.       vp_x, vp_y = 0, 0
    % G2 T8 D5 B4 E& j8 O% X
  944.     else2 X! l! m4 a  H1 ]+ [7 `, s* K
  945.       vp_x = viewport.rect.x - viewport.ox0 a/ l7 e0 R3 m6 \& ?
  946.       vp_y = viewport.rect.y - viewport.oy
    $ M/ g  R/ V: h/ J$ e3 X
  947.     end
    7 ~8 D( t' `; J1 C. }
  948.     item_x1 = vp_x + x + standard_padding 9 k0 i2 B6 U3 W' N0 n8 C4 q# c
  949.     item_y1 = vp_y + y + standard_padding- S1 S# d2 B& d3 l! N6 f/ v
  950.     get_index = @index  0  0  @index
    , J' T+ ]) {, f' p3 M4 o+ r
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)2 b* a* [+ z, [' d) i" N" F
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)* c8 Y- S  X. ^8 {. m
  953.     Mouse.set_mouse_pos(new_x, new_y)4 t! e) h# @3 f7 |
  954.   end
    ) ]  i; |0 k" t3 n7 G4 I: F" W
  955. end
    . y- W, F$ {1 ?5 {% n4 o; v
  956. ; q) L& @. C# ~3 l
  957. #==============================================================================
    $ [4 b% f6 {2 E
  958. # ■ Window_Message5 w: K9 x4 s9 {/ P
  959. #------------------------------------------------------------------------------
    $ a% h$ C( r9 D/ k6 V( W7 E0 o
  960. #  显示文字信息的窗口。
    2 t7 T/ H, `+ U; D  c. i5 m. {
  961. #==============================================================================
      A9 R- D" S! n" o; P: D3 }6 B
  962. class Window_Message  Window_Base" m$ M3 d  n( ~4 R1 E9 d3 h; i8 Q& m
  963.   #--------------------------------------------------------------------------
    8 R- E' I! ^. L" Q( d0 w  x; z
  964.   # ● 处理数值的输入(覆盖原方法)( N5 T, c0 W  ^: I# S# U' L4 B
  965.   #--------------------------------------------------------------------------! V( \( Q  C& z* }
  966.   def input_number' k8 C% @" k! \! E; E+ S( x0 A! W
  967.     @number_window.start
    8 l$ m5 M' y5 ~  ?# _
  968.     Fiber.yield while @number_window.extra_window.active/ t# _# Z7 B$ P6 L, V
  969.   end$ q: t, Z" [0 p  |' z  F
  970. end# ]  ?- T% |3 Q+ E. \

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

  2145. 9 ~/ ?( O6 \& @* U3 t% U
  2146. #==============================================================================
    0 a2 c5 l- d- E
  2147. # ■ Game_Map
    ( p# B- q! J  U: W
  2148. #------------------------------------------------------------------------------" a2 ]8 i9 R/ ^& {) j2 ^* l& ^8 {
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
    / L0 c" A4 S8 H: q6 L, P
  2150. #   本类的实例请参考 $game_map 。
    6 l4 G' U4 i: n" f) v
  2151. #==============================================================================% G7 ^" P% M* u0 ?" Z! G
  2152. class Game_Map
    9 }1 L9 G7 M& M* |- e
  2153.   #--------------------------------------------------------------------------
    ' M" r4 q- q/ z; C  c, k/ e1 Z+ d
  2154.   # ● 定义实例变量5 N5 s( \+ b3 Y( r/ R
  2155.   #--------------------------------------------------------------------------1 J/ w2 N# T- R; s+ m" e
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
    & M- J, I, z- {! X
  2157.   attr_reader mouse_map_y # 同上0 i9 ~/ z, Q$ y5 _
  2158.   #--------------------------------------------------------------------------
    " E2 \, d' U, Y- m! t4 M
  2159.   # ● 初始化对象& i5 [1 D$ ^  Z/ }: w' y
  2160.   #--------------------------------------------------------------------------% S; P4 c" t5 k" h5 Q
  2161.   alias sion_mouse_initialize initialize+ E) Z8 J7 y" s+ A+ w
  2162.   def initialize7 m  f* U: q7 @4 B5 d8 H
  2163.     sion_mouse_initialize2 m2 t- C* J( y  D* F; @# \# {
  2164.     creat_move_sign  ###. u' ~3 M& K# o
  2165.     set_constants+ l! f% V; }# B7 K2 s% w! _5 U$ N8 t% h
  2166.   end4 J) p2 n) z/ ~8 v' H. ]
  2167.   #--------------------------------------------------------------------------
    $ i  u( v' `  c# z7 c( e
  2168.   # ● 更新画面3 e5 K- r' C) W
  2169.   #     main  事件解释器更新的标志
    & C; p, X0 p: {7 z: A- ]
  2170.   #--------------------------------------------------------------------------
    3 j# w6 J& z5 S% }9 p
  2171.   alias sion_mouse_update update
    " m5 V  j/ p2 L& s
  2172.   def update(main = false)- W/ |$ ~6 l* S7 c+ m$ W
  2173.     sion_mouse_update(main)& h9 ^% B% v  h8 Q2 F; G, a
  2174.     update_move_sign8 x' H! C. c8 w. r" d2 i# \' P
  2175.   end
    $ p& t1 [& R; H' W  L% [3 h$ [
  2176.   #--------------------------------------------------------------------------) P: O6 i- Q0 `; D) t& F$ E
  2177.   # ● 创建显示路径点的事件
    % _, ~  n" A; t; f$ S0 R
  2178.   #--------------------------------------------------------------------------
    3 V4 h! b$ {1 s* E! U2 C
  2179.   def creat_move_sign
    , w( D  Z! A  g% Q$ x
  2180.     $mouse_move_sign = Move_Sign.new$ E! v: }9 a2 o& W/ B
  2181.   end: {: ]0 ^& o* w- b1 u& I% {) ]0 @
  2182.   #--------------------------------------------------------------------------( k9 h2 e2 i; A1 z
  2183.   # ● 更新显示路径点的事件
    + k1 z" k+ l6 V9 p4 T
  2184.   #--------------------------------------------------------------------------
    " g, l0 n/ k, A% E
  2185.   def set_constants
    7 [/ T8 r+ o/ B4 L" B9 h
  2186.     @mouse_pos_setted = true
    # H; u; u! g8 ^
  2187.     @set_pos_prepared = false
    ' f: v4 J3 {* S5 M9 H5 \( a( |! Z' D
  2188.     @mouse_old_x = 09 P' H+ u) n9 M- J- c- }& j
  2189.     @mouse_old_y = 0
    " H1 L" w# t4 e, c0 E8 j
  2190.   end
    * d. r. k  |* b9 R, I) z
  2191.   #--------------------------------------------------------------------------
    ( P* ^- O) J; j' f- G$ n
  2192.   # ● 更新显示路径点的事件2 \# c6 C# t9 ]
  2193.   #--------------------------------------------------------------------------4 z5 p- R8 w/ w' V! Z. L" u+ e
  2194.   def update_move_sign6 H) }. V  o  |% @, E$ G" E
  2195.     $mouse_move_sign.update- e' \  f  G) p' `2 X. w
  2196.   end: ^! M' C/ B  j/ `; o2 K2 O
  2197.   #--------------------------------------------------------------------------1 D" [' }' {* \1 Q5 y$ [$ Z4 p
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    / g" O6 g  K6 j
  2199.   #--------------------------------------------------------------------------% g4 I+ m2 A# {1 m1 A
  2200.   def get_mouse_map_xy8 [- A0 q, K  k0 k, N" j0 K
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y9 U4 S! D2 D4 K7 Q
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    2 S+ f3 p0 l/ P) R6 N3 o3 K3 D
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)* W$ v0 C1 q* b# S' g: i
  2204.   end
    2 ]* s& }1 `( ^' }* N
  2205.   #--------------------------------------------------------------------------' Z2 P! d! N( o9 x8 R" U
  2206.   # ● 返回地图画面时重设鼠标坐标
    7 O$ f# A* Z' C' d" k  |4 _$ B
  2207.   #--------------------------------------------------------------------------$ h1 D+ T9 T9 s; k* m* C# M7 [
  2208.   def reset_mouse_pos4 N; a* x7 V2 E) e& p9 s/ t
  2209.     return if @mouse_pos_setted1 \7 o& L9 l! J0 H' d
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)0 i6 [& ]2 Z6 o$ I
  2211.     @mouse_pos_setted = true; @+ I  G2 G, o
  2212.     @set_pos_prepared = false
    6 A) Y8 k/ `  _
  2213.   end
    % |2 g# U+ u6 w" V- ~+ ]) o- k
  2214.   #--------------------------------------------------------------------------2 e( S3 p* {( e7 `& Z& M% l
  2215.   # ● 重设鼠标的坐标
    7 D) [7 N6 e% i  W6 G0 ~2 T( W0 e
  2216.   #--------------------------------------------------------------------------3 c: f0 E) D- ?
  2217.   def prepare_reset_mouse_pos
    7 T' t( M( x9 |- `6 k0 R' A
  2218.     return if @set_pos_prepared
    5 v% B" S$ w* C, A! g  J! ]1 ~
  2219.     @mouse_pos_setted = false
    . e; e: t; n! X1 W' L5 E, b
  2220.     @mouse_old_x = Mouse.mouse_x! A! S. ~+ C  n5 K
  2221.     @mouse_old_y = Mouse.mouse_y3 Y7 s* x0 E) D+ A( }8 a
  2222.     @set_pos_prepared = true7 w! U7 G. }" b  B
  2223.   end( J  X  p2 W6 ]4 g. H; q+ R
  2224. end/ W' N% ~8 L- z+ B$ C
  2225. ) q) B& p# Y: f9 o
  2226. #==============================================================================4 \% V3 p- E$ a, p6 U
  2227. # ■ Spriteset_Map) T" N9 n9 M9 g4 x8 T
  2228. #------------------------------------------------------------------------------
    1 `* B& ^, V4 O: m+ M4 C
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。2 Z  @, u  S+ V! V) i7 w9 Q/ \
  2230. #==============================================================================2 R% A1 @$ B- |
  2231. class Spriteset_Map
    / L/ J/ x# @7 z+ H$ j5 S. J5 e) n4 [
  2232.   #--------------------------------------------------------------------------. Z0 [" L; N) r6 {
  2233.   # ● 生成路径点精灵
    & w8 V2 J- }% v: b& n0 x
  2234.   #--------------------------------------------------------------------------/ p2 e9 ]& A# B! Y7 U4 P3 A" Y
  2235.   alias sion_mouse_create_characters create_characters! b  Q0 e" @$ ]2 T. D
  2236.   def create_characters: h; _$ r- Z2 @
  2237.     sion_mouse_create_characters3 z' z: }' e% A5 y$ W
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    , b& j7 W/ V3 e" l
  2239.   end
    ) \8 y6 Q2 a! V1 D% S
  2240. end
    7 z# [0 i  q6 Y% G& h
  2241. + g) J7 A1 K( f- Q7 B4 z
  2242. #==============================================================================
    * f- J1 n& }; ^- e% T
  2243. # ■ Scene_Map8 l2 ?1 t5 H! D) o. p7 d
  2244. #------------------------------------------------------------------------------
    8 L  @/ K: t/ p! q$ c
  2245. #  地图画面
    . I+ g$ G. [$ \4 r, ^2 z; E
  2246. #==============================================================================1 r; I3 T+ ^& v5 @% t2 g3 K
  2247. class Scene_Map  Scene_Base
    % u5 I% Y' }4 O' l* c4 V; [
  2248.   #--------------------------------------------------------------------------1 ]8 u% S" Y* M! h: h
  2249.   # ● 画面更新
    5 F4 p8 C" i6 ^
  2250.   #--------------------------------------------------------------------------
    , ?! @8 K, _9 A9 g! {3 |
  2251.   alias sion_mouse_update_scene update_scene
    - Y! i! ]/ j) P/ Q: e0 N
  2252.   def update_scene3 s- U$ h  j8 s' g7 {' ~, }" z
  2253.     sion_mouse_update_scene
    # }! m2 l# Z# M& K, n
  2254.     update_mouse_action unless scene_changing
    * W" E5 m- [1 J
  2255.   end
    3 d% d. R! R9 q& g, v
  2256.   #--------------------------------------------------------------------------
    5 ?- M4 x/ Z0 ~; U
  2257.   # ● 场所移动前的处理4 Q3 U) K/ T9 Z# I/ k" x* J$ Y
  2258.   #--------------------------------------------------------------------------4 ], L# i- J0 [: W- k- v8 `7 |
  2259.   alias sion_mouse_pre_transfer pre_transfer8 ~. |5 y% B7 d, F
  2260.   def pre_transfer& B) _$ `0 _# F% c; O- O
  2261.     $game_player.reset_move_path  b! u; s7 n! [* C( U
  2262.     sion_mouse_pre_transfer( v8 l3 F" I/ H7 q# R0 K& {
  2263.   end% Q1 W  O" n1 [% C+ l% n5 |# |+ q- z
  2264.   #--------------------------------------------------------------------------
    / Q' }8 N& z- j  d1 n  J. ?' t2 [
  2265.   # ● 监听鼠标左键的按下
    ' C0 h' P5 ~% P; Z/ e8 C
  2266.   #--------------------------------------------------------------------------. l  m5 F" ~; D! ]
  2267.   def update_mouse_action
    * ^# R0 {% S( v- K+ T1 q$ D
  2268.     $game_player.left_button_action if Mouse.press(0x01)0 m7 I$ N/ p; N
  2269.   end
    5 J- }4 h: t/ A) ~/ l, t/ Q( v
  2270. end1 p* u7 r" w+ K0 s0 c" h

  2271. 0 f: l  s6 M' x0 X' N
  2272. #==============================================================================
    5 i3 D) O' W% |* E1 b
  2273. # ■ Scene_File/ }/ |) w- }0 M, @$ a
  2274. #------------------------------------------------------------------------------
    ' K6 z* H& \/ M1 _: d& ^, W
  2275. #  存档画面和读档画面共同的父类
    , y5 _$ `9 R- n) k* `
  2276. #==============================================================================
    ' _* C6 ~" Z3 U, Q' [" c' d
  2277. class Scene_File  Scene_MenuBase7 B" X  U# Q+ A6 e
  2278.   #--------------------------------------------------------------------------
    / w; F4 j: ?# S. Y' P
  2279.   # ● 开始处理
    4 E8 E" \/ M. R( D5 G
  2280.   #--------------------------------------------------------------------------& o; X, K2 `& ]+ S8 E9 v! l4 N7 [
  2281.   alias sion_mouse_start start
    . V4 n* \1 V& c4 H  Y
  2282.   def start" l& C4 A8 M2 \
  2283.     sion_mouse_start% N( j, R1 _# ^- J
  2284.     @move_state = 0- M* y1 K4 v6 l( |4 [6 J! e, }/ ^
  2285.     set_mouse_pos& \- ~+ n6 A" @' Z3 ]
  2286.   end
    ' m5 N5 y$ {' F+ G5 p$ i5 y
  2287.   #--------------------------------------------------------------------------
    2 L: J9 o8 r6 X3 p, O
  2288.   # ● 更新画面' o' @) a9 r% p) F+ _/ d: v
  2289.   #--------------------------------------------------------------------------
    # o6 I. m0 h1 C9 a. g; I0 @
  2290.   alias sion_mouse_update update
    + i* f4 _8 Y2 o, ~  T! H
  2291.   def update
    - B  R; Z' b8 s. A
  2292.     sion_mouse_update
    7 A6 ], x" X* D; o* ]
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    7 T: b( L& o1 w- |3 ?7 W
  2294.   end
    1 N5 z& r9 G- T1 i+ p
  2295.   #--------------------------------------------------------------------------; c" M, b& R7 `; S* j
  2296.   # ● 更新光标$ X' K9 F  o  }5 o4 c, {# }
  2297.   #--------------------------------------------------------------------------2 L! l* P/ z3 W! o& \8 A5 M
  2298.   def set_cursor7 D% j' i6 j, o7 F4 @( i, K. T
  2299.     @move_state += 14 k* P$ H# a, O
  2300.     last_index = @index
    ) g8 z4 M8 q  {- D" Y4 c
  2301.     if mouse_which_window == -2- G" d6 v+ B: K% C: ~# g! c! f+ @
  2302.       if (@move_state - 1) % 6 == 0
    ) I5 v: X  \& |+ ?. E
  2303.         @index = (@index + 1) % item_max if @index  item_max - 12 @3 y9 C) Q5 r. D0 i! F
  2304.       end
    6 B. {/ p5 y4 w$ d0 b% _4 x! B2 w6 A
  2305.     elsif mouse_which_window == -15 _8 q4 H; L0 j! v+ Z
  2306.       if (@move_state - 1) % 6 == 0: R7 F, r/ e+ N4 p9 ?% f3 u# g6 [
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    / Q9 d" O. A: u! i& Q+ I
  2308.       end
    8 f8 I0 `9 e7 y9 n+ W5 C! x, j
  2309.     else
    ) L* D: a+ Q7 }1 B* f1 ~, P
  2310.       @move_state = 0- v, F) o- D7 ^; k+ s" j
  2311.       @index = top_index + mouse_which_window
    ' U2 v& D; x. D4 @& i0 b
  2312.     end
    - x0 i7 ]2 h1 i3 l- B
  2313.     ensure_cursor_visible
    % x& Y9 K7 |+ ?: W" C
  2314.     if @index != last_index9 M$ J- u- D3 ^  c* z
  2315.       @savefile_windows[last_index].selected = false
    : \& G; C4 ^5 c
  2316.       @savefile_windows[@index].selected = true
    ' G, x) G6 T1 u- W
  2317.     end
    9 t  S, U7 Q( Q1 L1 ^6 ^9 X* h
  2318.   end" A# _- x2 j" p9 @/ v
  2319.   #--------------------------------------------------------------------------
    7 \' J; N/ O) M& A5 L8 U4 ^( `
  2320.   # ● 判断鼠标位于哪个窗口/ |( O% n% ^1 ^) R4 D
  2321.   #--------------------------------------------------------------------------2 q, T- ^8 K7 Y4 x' \) b* r# X, H
  2322.   def mouse_which_window
    ( s: k5 Z9 O( k/ W' \
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y3 t3 X: H% ]5 M, ~' e
  2324.     if mouse_y  @help_window.height + 14
    & p% S& U7 k) _$ @8 \
  2325.       mouse_row = -1
    & T' H. Z9 t& m: ]1 M+ p
  2326.     elsif mouse_y  Graphics.height - 141 y9 Y8 E9 t2 m& u. e$ G* j7 I' F
  2327.       mouse_row = -23 v% j2 c: Q- N- l, V
  2328.     else! W# K2 f0 r: o% y
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    " P& N0 f; k# ]2 t$ C0 j5 ?' V
  2330.         (Graphics.height - @help_window.height)$ m/ b0 z& g" M; I
  2331.     end
    ! b1 u4 T9 z' `7 ~4 g
  2332.     return mouse_row" R9 |; S- {" ^; L( E% P0 G: U. M
  2333.   end
    7 c9 D7 u) I! ~) P) Q
  2334.   #--------------------------------------------------------------------------: D9 v/ j% g# r5 p
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, F) ~6 |% z7 C; @
  2336.   #--------------------------------------------------------------------------
    5 R; n- Q8 m* J! Y: a% ]  a
  2337.   def set_mouse_pos
    & e' z$ }! `! V) N' l9 t8 @$ W
  2338.     new_x = 401 s2 W9 v  N- T
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24/ E9 \3 |3 O8 e- A1 ^
  2340.     Mouse.set_mouse_pos(new_x, new_y)! K! k+ ]5 I2 `. {
  2341.   end
    1 L1 u7 R2 K3 O* n# _7 C
  2342. end
    % K3 L/ h. L2 W- b* A. U: I% C
  2343. 5 q3 v# \% o) ^
  2344. #==============================================================================/ N5 k7 f7 K) D6 H0 f5 G
  2345. # ■ Game_Event( Z1 `+ W& |9 Z1 S  l: d6 c
  2346. #------------------------------------------------------------------------------
    + G: n4 J% Y1 J) b! J& T$ a5 l
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。+ p) {* I0 t) O1 z# r8 N* K% p3 n
  2348. #   在 Game_Map 类的内部使用。) ?) L* ]) M. J/ X7 F& ~! c, ^
  2349. #==============================================================================
      H2 |2 [- a( Q+ B: ^* e4 h$ p6 i
  2350. class Game_Event  Game_Character
    9 I# [( A4 J8 b: h
  2351.   #--------------------------------------------------------------------------# Y/ N7 ?" X, Q1 N; P5 I9 l& Y3 E
  2352.   # ● 事件启动
    & F/ f1 d8 R8 Y
  2353.   #--------------------------------------------------------------------------" v) _" ~  L) j4 M
  2354.   alias sion_mouse_start start
    9 T: {) v0 u1 l, h7 N) T8 Q
  2355.   def start
    6 A- D8 f* u9 Y* @/ w
  2356.     return if mouse_start && !Mouse.press(0x01)
    ' U: s) I% w: R8 q; q
  2357.     sion_mouse_start
    * M0 e4 Y1 ?. p% w* [9 F
  2358.   end& W* z! }" l) ]+ ~4 R5 Y
  2359.   #--------------------------------------------------------------------------4 U7 T. p8 L& `( z2 `& ~, E
  2360.   # ● 判断事件是否由鼠标启动
    3 ]) d" [( U) u0 c0 \7 D! l
  2361.   #--------------------------------------------------------------------------
    ! g! s' V3 X  T0 N
  2362.   def mouse_start
    - D8 X& M; w9 s3 G; X" A
  2363.     return false if empty: L' p' r8 j# l& M# p
  2364.     @list.each do index( `+ X- C2 n; z( L  W' n0 R! u
  2365.       return true if (index.code == 108  index.code == 408) &&
    7 O' H& {- n: t2 O3 ]# ~
  2366.         index.parameters[0].include('鼠标启动')
    ) T: {5 ~! x) T& b: u( G, r" q+ `
  2367.     end( k1 v* Z. e" d" F! o# v1 z) v
  2368.     return false2 ~) K6 u* P1 v) k  o) v9 b$ P% s
  2369.   end8 }% x! p1 w' H, r2 m- O! r& r
  2370. end
    % D& Z0 Z: D5 |

  2371. # J* C& \1 C  r8 D4 C1 E5 Y
  2372. ####泥煤的height  m  {2 F* v7 @! u
  2373. # @height = height+ N* ?5 E5 Y! t! N5 A5 g/ n5 n
  2374. 3 z3 E3 Z( `+ f' o1 Y
  2375. class Area_Response
    ( j* R+ h' w( a
  2376.   attr_accessor type8 Y  R& M& ?4 a" ^! n3 X- n8 f0 Z2 M
  2377.   attr_reader ox
    # m& U4 B4 x% M1 E7 z2 E( k! Q
  2378.   attr_reader oy' O& f1 P" @0 ]2 H+ u% [, [
  2379.   attr_reader width' n5 S2 k3 \9 ~7 @$ @5 c8 [  K
  2380.   attr_reader height) g8 p+ L3 Z* N' F
  2381.   attr_reader switch_id
    , p7 O' w1 l/ h2 |" A
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)8 D1 r: u: g( ]1 D4 q/ S- c
  2383.     @type = type0 `5 F) `! F  J
  2384.     @ox = ox" p  r5 W9 {0 @
  2385.     @oy = oy5 M; g% F' K/ ~$ y, J+ E# k& S* V
  2386.     @width = width
    8 F, U; E% m3 W6 a# {" r
  2387.     @height = height: g/ ]* l  Z6 v: N. p
  2388.     @switch_id = switch_id( p; u! x* F; r3 ~" i6 L
  2389.   end! ^' O! K, G) ?- ?
  2390. end; o3 x* w6 Q/ o/ u) E
  2391. 2 V3 F0 I1 j( k4 S' g2 a" E
  2392. $area_responses = []' O2 z+ P3 p- i- J7 P4 @
  2393. 9 d* r$ S( k3 Q$ k7 H) G0 \
  2394. class Scene_Map
    ; I7 k- E& d! A" r% a/ w
  2395.   alias update_mouse_2013421 update_mouse_action: u  {* f+ D0 i  }" F
  2396.   def update_mouse_action7 G& X  s8 a# h2 v4 b& B
  2397.     update_area_response
    0 x6 ]( L0 b# T6 W& d. w
  2398.     update_mouse_2013421
    , ]+ X4 _0 |/ N6 |1 |  ^) e! b
  2399.   end
    ! F7 _! s2 ]1 [0 n* [0 R
  2400.   def update_area_response
    # x) ^& }1 C) C" J0 w
  2401.     responses = $area_responses& v, p3 q# o3 ?: O6 v
  2402.     responses.each {response
    8 G1 V9 a$ S) A- V
  2403.       ox = response.ox
    & _5 l9 v! S! P0 J
  2404.       oy = response.oy
    9 \- x3 P6 z/ c' `! F( w2 |
  2405.       width = response.width7 K, a2 o6 m1 o( o
  2406.       height = response.height4 b- I6 Q% Y2 ^/ F- ], d' C6 q
  2407.       switch_id = response.switch_id
    . P+ q* J7 V7 @& D# a% R9 u8 C
  2408.       case response.type8 X% T: q" D* R. G: G! X- r
  2409.       when 0$ }$ c9 X1 z+ s, H: O
  2410.         if mouse_in_area(ox, oy, width, height)
    ( c- [' E1 H; {
  2411.           $game_switches[switch_id] = true0 f) T2 \# F7 Q
  2412.           $area_responses.delete(response)1 h4 g6 S  F# C. X
  2413.         end% s' I# s; i& T6 g
  2414.       when 1
    9 a  P% `. _. F" E/ b; O
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01); y7 j8 Y- ~- j# r9 O* W  L% c, c
  2416.           $game_switches[switch_id] = true) [. Q5 ^7 @. O' l  h
  2417.           $area_responses.delete(response)3 @5 o7 q! R' l; |
  2418.         end; W- |0 E$ Z5 K& R7 _/ U
  2419.       when 2
    & m) V) n+ C$ S' M" x& X
  2420.         if mouse_in_area(ox, oy, width, height)6 p/ q& c1 ~1 `, l8 m/ J. ], m
  2421.           $game_switches[switch_id] = true
    ; ?+ k5 U8 G0 E
  2422.         else! q, Y! m5 U" q' S
  2423.           $game_switches[switch_id] = false
    & H4 [$ G9 q- L4 T$ W  k0 y, Z6 k) s
  2424.         end* ^, Q0 ^/ O$ u' `! p
  2425.       when 3+ B6 {/ R9 |, d2 e! D8 P9 [
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,% ]$ I* Y" ?# a, e
  2427.             (oy - $game_map.display_y)  32, width, height)
    , C6 z: l5 J" a( z
  2428.           $game_map.events_xy(ox, oy).each {event3 {/ ^% n; J& k( t
  2429.           event.start4 W2 `  p7 r% `2 l+ P( C0 R2 P
  2430.           $area_responses.delete(response)
    0 [/ A5 `7 K4 b$ I! T
  2431.           return! z, u( V& X( O  \6 A! ^0 [
  2432.           }
    3 v, c/ F+ m  k. U6 h( B, t% X/ z
  2433.         end
    3 k: d, S) @/ _6 R( k
  2434.       when 4$ C% e1 O! I7 |1 `5 X( z; r
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,% k! j; F3 ]3 W8 q" ~* [  k
  2436.             (oy - $game_map.display_y)  32, width, height)
    5 X. n) K: c  B! p/ z6 s
  2437.           $game_map.events_xy(ox, oy).each {event4 H! m2 N: M' e* \
  2438.             event.start
    ; a$ K4 D% a/ o4 t; S! e) R4 I
  2439.             return
    ' \* o+ U5 A* U& N7 i# F! R7 ?
  2440.           }
    # h1 z0 m+ {: D& F' Z5 a
  2441.         end/ m/ a! f3 w. k
  2442.       end, [' J# b1 D; |8 a, ^2 B2 X
  2443.     }6 ?: f$ C! J) A+ E4 h
  2444.   end) b0 i3 U* D/ p4 I7 z. @
  2445.   def mouse_in_area(ox, oy, width, height); ~* p  o: H2 D  C: a4 K
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&# p: @. R5 i4 d5 X/ N% z# g8 w
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height5 P, _& \& ]% v7 ?1 L8 ?
  2448.   end* Y, f  X* u7 K; q; Q5 B
  2449. end
    8 F4 ?# y- H' P$ c: O: {8 n/ |
  2450. class Game_Interpreter
    : w4 B' x6 w$ ?3 R6 X7 `
  2451.   def area_response(arg)# z2 P  \9 x2 }( ^( Y$ h. ~( q3 @
  2452.     $area_responses.push(Area_Response.new(arg))% B1 A& d2 ?! x
  2453.   end! k$ M% i/ B2 z. |7 H
  2454. end
    ) k* U" B% {& P7 z. Q
复制代码

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

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

GMT+8, 2025-9-11 14:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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