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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================1 Q$ m, b. Y. C& N  {
  2. 4 Z! ~, k' S/ [3 Q
  3.   Sion Mouse System v1.3e
    . t- U2 |3 c+ P2 s
  4.   & u$ f1 Z% X/ g1 x. t- C: H; C
  5.   Changlog7 }) q! F% J) Q; J& P" S4 ^% |' P
  6.   
    / D1 l% U, i/ _6 ~/ \
  7.   2013.4.21 v1.3f
    4 u8 f1 P* P6 }1 ?. P
  8.     3 K' f! G# K! B4 G+ R: l
  9.     1.3f 卷动地图 bug 修正
    + d& k9 p) Z+ z: z' V& X& ]/ w
  10.     ( I# }) Q5 f. \7 m) Z
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口+ |1 ~. M, `2 T
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
      d3 `8 U  ]8 S2 ^1 Z& r8 s
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    , }& Y. C( f) H& Y5 W' A

  14.   R# U" e. T- e) x8 t& B
  15.     1.3f bug修正
      i. E% c9 e7 M( b$ Z  q2 O. q: l
  16.   
    9 B/ ^  j) \$ z( F& ?0 M
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    , \- j% @# m4 s' t/ [
  18.           关闭菜单时,鼠标是否移动到原来的位置。0 Y  N" p4 o) Y* P

  19. ! h' b9 w0 H# C, a2 N3 I3 D
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    * K1 Y) L! f- u7 J4 w+ {# {

  21. 3 g8 s3 u8 H) h2 q; B7 T
  22.     1.3b 修正一些罕见的bug;
    # e% C( `9 S1 r4 n6 |
  23. , o" ^9 h4 T5 U& [, V8 u
  24.     1.3a 代码小修改;6 f! n# c% F3 x# i
  25.           加入了鼠标点击启动事件的功能,6 A/ h+ {% T( Y* Q; {9 l3 {/ O. m
  26.           在事件中加入“注释”: 鼠标启动  ,
    , D: [3 b: B) C# a8 F6 |
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。: q2 i) ^2 ?$ }6 I" A( E
  28.   
    & {7 K" e: L0 u7 X( D' |* V
  29.   2013.2.12 v1.2# J% z7 p: D& g
  30. ) b) ^- ?/ m& `3 w# r* h5 k
  31.     寻路逻辑优化;
    9 F4 o# i" e5 p8 D
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;  n( Q3 I& s6 b$ \. C
  33.     现在支持用鼠标来操作载具了。7 [3 b4 X6 @% ~% `' t  y

  34. ( ?" U6 x2 @+ ]  W" s
  35.   2013.2.8 v1.19 O, F. D5 b8 B( S0 Z( e

  36. & ^1 B  Y9 u' N( G3 S
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;2 c8 r3 ~. K2 t5 C
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    . t8 i4 U4 G( c: d: T" c. B
  39.     移动时,路径指示点的绘制更加稳定;
    " t) Z* d3 {* N. {8 |8 G( [
  40.     现在支持默认存档画面的鼠标操作了。2 [5 ]# p  R5 o/ l
  41. 9 z- l9 l+ T: N8 |1 y- ~9 B2 r
  42. * ?1 {$ E1 e& G0 n' [
  43.   OrigenVersion' ~% [) k$ ]: i
  44.   
    5 j% d) d4 R; r' A7 n3 I3 \" c
  45.     2013.2.7 v1.0 # D$ C7 |/ I& M

  46. 2 [9 u$ n5 U: I' |6 t
  47.   主要功能3 N. Z9 @8 w7 i, @& d  b2 b

  48. 5 z. C/ c5 [: Y, C
  49.       使用鼠标进行各种操作...
    % ?) m  c5 O* I) T+ E
  50.       将鼠标锁定在游戏窗口内
    0 U* l% j# s0 x; }  X$ T. p. [7 `" Q
  51.       自动寻路,按住 D 键可以扩大寻路的范围5 a/ N5 i1 C2 ~1 |% }! p1 H% o& J
  52.       双击鼠标进行冲刺
    3 Y( W) I, I7 U( _3 L
  53.       更改地图卷动方式以适应鼠标移动9 X, k2 I# g5 f/ v/ v0 B' ]
  54.       变量输入框改良3 _5 z/ R% o1 p; @* n* Z$ D7 M

  55. $ d$ Q7 e$ u; n- b
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    + C# l- f: V; j% }. J. t
  57. " e- U) X/ I* h) e0 ~1 g! k8 I/ `% L
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    * _& w5 Q" m! n) L
  59. 6 a5 z( p' a8 G- Y/ L! b3 v. b
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭( v! t' J! Z1 h1 S6 k, W9 i
  61. ; V0 k. }4 j7 A1 \5 X; K4 S
  62. ' M. N( K% d+ t9 l; C. A5 l) `
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★7 m, u7 V7 o* J: x0 f$ R1 [

  64.   Y* N, c$ s! m/ t* B" m: {, |% I
  65. 4 L5 q) b2 c' K8 Z1 k
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    * a/ Y. s1 o! `' T1 y

  67. - c/ q8 X; h; t3 K7 k
  68. #==============================================================================
    ' a5 M" r" _" s. U7 l
  69. # ■ 常数设置 7 u( O* p- _1 C  v2 N; v  p
  70. #==============================================================================
    & h" Z6 m% r& Y
  71. module KsOfSion
    7 |% }7 `$ r) z" u( C$ R, e5 C
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false1 o; c: z- t5 O' \, C  L
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    3 C8 z6 l7 }  z  Y0 r
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false9 J: o* V- n/ u1 n4 t* }  k
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量' G7 R5 C1 P* O
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处) ^2 Y$ T& B# [/ |
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧$ J- b$ s+ e9 B0 s' O1 ^; X
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)2 m4 C# i5 u) @
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    9 o/ @0 q9 ]7 `- g2 z9 O3 s2 p6 s( v
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    + x* H) @2 Y* V4 b7 g
  81. end
    6 `9 W/ z( ?. C! l1 l( r

  82. ; X. ^; U# d+ \% I* G+ p
  83. #==============================================================================
    1 @5 s, E! g2 e5 Q& L3 S
  84. # ■ 用来显示路径点的类
    ! Y; O: o7 q9 \" P! X
  85. #==============================================================================
      [# ~+ V, m' ~; {$ W
  86. class Move_Sign  Game_Character
    7 I8 [- q2 L$ I- |% b3 Q0 r
  87.   #--------------------------------------------------------------------------1 C3 C3 U, }1 l2 i) e" M
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    2 k) r( y+ H. q( B( |
  89.   #--------------------------------------------------------------------------8 j0 w; n" D- x1 S9 G1 z; J* b; O
  90.   def init_public_members8 @6 X5 R2 y' t# Q. L! r% Z
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹1 H. l9 h$ m* b
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0. U/ n4 e) E$ W. W( l
  93.     @move_speed      = 5        # ★ 踏步速度
    . S* i6 P/ e+ a6 \( [
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    7 B! w; }' Z- h7 w  ~: }" L
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度6 c/ J1 z7 E  _4 w+ ^# c
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    ' H) B3 l0 [  A
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    # b$ v2 c% u$ F' i
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)9 e: E; Z( q9 Y
  99. / s) x5 ^* ^1 v% ?$ j" ?. _

  100. : h. R5 `, O; [( j
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★9 O6 k8 k' N& Z0 g

  102. # s5 f* o: Z. |& n5 N0 C$ O

  103. ) Q4 q: f( m# S+ z8 R
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    8 q( l- Y5 C$ a! o
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')" D0 T1 V! M1 K$ M

  106. ( k  X" T' ?1 j! |
  107.       if $no_arrowpic_warn
    & Q! U  i" N; {( e. }7 e- i
  108.         MouseShow_Cursor.call(1)5 F5 b# U: y0 A% y
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    ) g4 b- n+ h  V. x
  110. 5 m$ r( J, J/ R/ J1 j
  111. “路径指示点”将使用游戏自带图片6 B% c  E6 Z' P% S7 A

  112. ( o3 E/ J$ u" }& y
  113. 该提示可以在脚本内关闭')
    . U3 {  g; j! |1 \3 |$ y8 ~6 Q3 `
  114.         MouseShow_Cursor.call(0)
    * y' k& l9 _$ f. W) X! O7 V9 d
  115.         $no_arrowpic_warn = false4 }* w3 {3 X, A% s# x3 r
  116.       end0 z7 A. n  K4 D9 ]4 p% y& T
  117.       @character_name  = '!Flame'
    , o+ @1 A# X' A2 Q% Q
  118.       @character_index = 6
    $ N& g4 b' H0 e9 }  B; a$ E
  119. - ~% A/ b' Z3 }* P$ @
  120.     end% k  ^- n7 T# k/ E" D
  121.     @direction_fix = false  # 固定朝向
    + g# S8 e9 R5 N: ~, d# B% _( t* j! h
  122.     @move_frequency = 6     # 移动频率
    - o6 I4 ~/ @9 G( N& Y
  123.     @walk_anime = true      # 步行动画
    6 N- F# f6 i  t# y+ N6 U/ A1 r
  124.     @pattern = 1            # 图案5 o9 U% u6 b6 R  H) A
  125.     @through = true         # 穿透: ^, p6 W" w* L2 U& Y4 E* K* o; ~
  126.     @bush_depth = 0         # 草木深度# I" D" P( }; _( `( f
  127.     @animation_id = 0       # 动画 ID1 F. h) Z2 n4 |; U
  128.     @balloon_id = 0         # 心情 ID
    ) z* a8 O5 ?5 X/ `; l% h
  129.     @transparent = true     # 透明
    ' Q7 E+ A* f6 l' Q, H
  130.     @id = 02 N5 e6 l/ l: k& _) R  [2 |
  131.     @x = 0
    & s+ ~- w+ ~9 C2 n- L4 T
  132.     @y = 0: K! w9 @& y$ v# b& @
  133.     @real_x = 0# W0 Z) y# o" a
  134.     @real_y = 09 ]9 a) t2 M  h+ ?" [& C# \9 H
  135.     @tile_id = 0" L0 u6 \* h( e* S) g( j0 f/ d/ |
  136.   end
    & G/ _) A5 _/ B. S  `
  137.   #--------------------------------------------------------------------------' N0 L- ^6 Q5 W4 u2 {
  138.   # ● 定义实例变量: O* P3 g+ X: `9 u: k, J
  139.   #--------------------------------------------------------------------------! j! w# x9 f5 H' c& {9 X
  140.   attr_accessor direction
    + f% _+ p( T/ v. l
  141. end
    / L9 w; B- P$ g; Y0 U4 c
  142. , U2 H! y% g3 }
  143. #==============================================================================
    % z5 ~2 N& n9 d! j& C; _
  144. # ■ Module Mouse
    + t& Q8 U5 B2 K, I7 l
  145. #==============================================================================
    ! B- u; v0 W" D( C" V
  146. module Mouse
    # O2 G7 h9 `4 o6 h0 d8 @; b& `
  147.   #--------------------------------------------------------------------------2 z0 n' O: @4 v5 ]" |0 U
  148.   # ● API& Q7 M7 _2 M' y) ~, x* e
  149.   #--------------------------------------------------------------------------
    + E8 j  P# X& X  u* x) V7 F! H
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    # d* E/ v" h- ~- y
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')3 K, F7 ?+ F/ r; d, Q) w3 e2 n
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')* n% Z+ K' Q+ q2 \
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    ' z" ^0 N& A! J0 d6 [! d
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    7 L6 \1 B1 w- m. ]7 x2 b0 E
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')& i! B  M; a8 |
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')8 \. [) l2 u: U' R4 g+ i
  157.   Window_Hwnd       = Get_Active_Window.call
    # _+ Y% |" w' h. x6 p$ O2 L
  158. 6 [6 s" d/ ^/ F- q" ~" H/ H* I! h
  159. class  self
    1 J, ~; ?+ g5 x: g3 \! m3 u: `
  160.   #--------------------------------------------------------------------------
    / @) J  X+ f9 g) K: X  ]* k7 ?4 _
  161.   # ● 初始化7 v' B8 U3 e, z+ s
  162.   #--------------------------------------------------------------------------8 K. u! h% F9 t0 ?1 c
  163.   def init9 E4 k5 f5 H4 f! ^' {
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor! V: U+ d9 O& e. U0 [7 R: G
  165.     @left_state = 09 I4 y- K9 I) h
  166.     @right_state = 0
    ! l- Y* f; i, T/ ?
  167.     @ck_count = 0 # 帧数计,单击以后从0开始, ?( b+ w  J7 K6 ~& W
  168.     @dk_count = 0 # 用于双击的判定) j, J* X% H' }, g: V% {+ V
  169.     @clicked = false
    8 ?# Z  n6 Z' I, c% j8 l: D
  170.     creat_mouse_sprite) t, J0 c" @3 k6 ~* t+ @6 g
  171.     update
    - E7 N# A; N8 L1 @* s
  172.   end
    . V+ b9 }6 n! x& o8 p  a, ?
  173.   #--------------------------------------------------------------------------- W6 h/ z' d9 E+ S
  174.   # ● 鼠标指针精灵
    9 m* g/ G. K2 _. D
  175.   #--------------------------------------------------------------------------
    2 Q  P. G( D5 N( h' `
  176. #~   def creat_mouse_sprite
    6 ~0 I5 S  }3 ^  d7 l& z
  177. #~     $ m  Q- ?' H2 s7 M: X
  178. #~       @mouse_sprite = Sprite.new
    ! s, P8 E  T( u8 Z
  179. #~       panda = 2#rand(2)+1
    * K5 x  }2 I7 K4 t+ K5 y
  180. " A; M) |1 L  C; `" h1 H8 a
  181. #~      if panda = 1
    8 \) s8 t' x; _5 Q; Z; b
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    : i) `/ M# X+ D& B1 I
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')9 X; r; \; `# R9 V9 Y7 y
  184. #~        end#with if File.exist8 g) Y; Z" E% `, h, S8 c9 n
  185. #~    ; s+ E! J! z1 D$ g0 h3 R0 e5 U
  186. #~     else if panda = 2 #with if panda=1. x. n% j+ l; t% p2 ^2 n
  187. #~      2 a. V$ e/ P( V8 M0 X2 C9 [( l
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    7 }: T2 u4 |( ]1 `% d; a( Z2 U
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    : O7 q. b: ^. V2 n+ Q+ M. Q5 a9 t
  190. #~      end#with if File.exist0 z4 S7 T) R" r, S' w
  191. #~       4 Q4 r$ f1 [1 y
  192. #~     else #with if panda=14 I+ a% p3 i. D) O
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    + I3 H- H; l( N6 |
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),, K% `8 O8 d9 j
  195. #~       Rect.new(5  24, 24  24, 24, 24)). Y2 F% k3 S2 u4 Q% A! e3 E% H" h
  196. #~     end#with if panda=1
      J. S# k2 ^1 M, _# `
  197. #~     1 x- X2 Y( p6 p" ^
  198. #~     #with def- `, Y( E2 q  b5 G9 B$ C( M
  199. #~   end1 k' Q9 l. s! s
  200. def creat_mouse_sprite$ k: i$ m+ h5 x. f
  201.     @mouse_sprite = Sprite.new* g, {7 P5 }7 w- v
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    : h) B2 @0 x* z- O
  203.     @mouse_sprite.z = 9999
    $ k3 r# B5 K4 O" k
  204.     Show_Cursor.call(0)% P' i; G$ l2 p9 ~
  205. end8 v; U3 @& z5 \# j4 L* Q* _

  206. 9 H- B) f: i4 i* x+ p
  207.   #--------------------------------------------------------------------------; g+ V* j6 X9 s+ D
  208.   # ● 更新/ _  P& h0 W" L- |& J7 S2 w- G8 V
  209.   #--------------------------------------------------------------------------
    8 I/ e) E- f! `: p2 I! K- a& H( a
  210.   def update
    " Z; U% Z% K" @' ]
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    % |4 e3 o! E" ^; I' X
  212.     left_state  = Get_Key_State.call(0x01)
    7 c* M. t8 n. W0 {7 Q2 O" L
  213.     left_state[7] == 1  @left_state +=1  @left_state = 02 n6 m7 h$ I+ m8 X7 p" X* R6 ~
  214.     right_state = Get_Key_State.call(0x02)
    + e' B1 t8 `# E8 ^+ }
  215.     right_state[7] == 1  @right_state +=1  @right_state = 03 }( W- p' H$ L4 s2 H
  216.     update_double_click+ m+ u7 j) a3 g! J1 B8 u
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1) c8 |6 \1 J- P2 f. [
  218.   end6 C: `5 @6 g" x9 C7 s$ U; D
  219.   #--------------------------------------------------------------------------
    ! K8 [; }' W! b+ [
  220.   # ● 获取鼠标坐标$ ^$ G" U2 j; E- x$ p& {! t
  221.   #--------------------------------------------------------------------------4 B7 q! K) D% ~+ `; |& |
  222.   def get_mouse_pos
    , ~7 B$ U' q7 j5 r7 {$ {
  223.     arg = [0, 0].pack('ll')' m& D; e2 R# L- I
  224.     Get_Cursor_Pos.call(arg)
    . @0 A. U+ Y3 U' ^# p% p3 N
  225.     Screen_To_Client.call(Window_Hwnd, arg)9 J! W. F- G5 s, f
  226.     x, y = arg.unpack('ll')
    8 D2 Z$ z8 _7 q) O% n* F
  227.     return x, y
    2 h6 p% n1 j) I9 p+ d2 m' j
  228.   end4 X8 K1 H8 `/ c  Y) Y  e, W
  229.   #--------------------------------------------------------------------------
    . e+ I7 G  V. e& O
  230.   # ● 将鼠标固定在屏幕内
    7 g, H& e$ s7 e9 W" j9 z' m/ @3 m
  231.   #--------------------------------------------------------------------------) s, C% K' n3 I3 _5 i. ?
  232.   def lock_mouse_in_screen: O: I; O, R/ X
  233.     arg = [0, 0].pack('ll')
    9 m( r' D- F5 Z9 P: ^& b8 k
  234.     Screen_To_Client.call(Window_Hwnd, arg)& n  ?$ ~" i# W2 ^: D. h0 f
  235.     x, y  = arg.unpack('ll')
    ) D0 n6 Z; L/ ]& z  F7 u$ }
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))) r9 x2 Z) S0 x* k1 l
  237.   end
    - B3 I3 `/ C! p! T$ D- d$ a( @% T
  238.   #--------------------------------------------------------------------------
    4 j6 b& r1 W  B
  239.   # ● 解除鼠标固定
    0 ^, z3 D- y9 ]" j2 C
  240.   #--------------------------------------------------------------------------5 y5 e5 C3 |1 R& T
  241.   def unlock_mouse_in_screen; Z7 z# \5 ~1 s% E2 z' |
  242.     Clip_Cursor.call(0)4 j  ?) a: i9 |0 l* g( ^
  243.   end2 J! m  B5 u4 g; q/ @+ r* l
  244.   #--------------------------------------------------------------------------
    / a0 W, q0 t7 |% B
  245.   # ● 鼠标双击判定
    ; I6 ]4 L3 h, t7 n5 ]
  246.   #--------------------------------------------------------------------------
    9 s" K$ @+ Z9 Q( U, b
  247.   def update_double_click( L% O+ }; R; i$ k. o3 I& S
  248.     @clicked = true if @left_state == 1
    ( j. v; P7 l) M* z5 i' X+ Z
  249.     if @dk_count  0 && @left_state == 1
    7 i- R1 ?" A' f. F
  250.       @dk_count = 0; @clicked = false
    3 M  E! t4 F8 q5 p" T7 e* z8 C2 C
  251.       return @double_click = true
    # ~) r3 F3 W8 s+ ~
  252.     elsif @clicked4 B* c: o: ]! t3 q! u1 g
  253.       if @dk_count  KsOfSionDbclick_Frame
    " e/ e* C  C) A% `8 q( M2 V
  254.         @dk_count += 1, E1 a% d( ^" f; R
  255.       else
    . S9 M( d4 u% l2 P& Y
  256.         @dk_count = 0; @clicked = false# W- k% G$ }, ~/ t
  257.       end
    ! L- x5 V3 Z* \  a+ @
  258.     end
    " p, E  d  }3 p3 r
  259.     @double_click = false
    * R0 X8 M. W+ z
  260.   end- f# S; a2 U; T. @
  261.   #--------------------------------------------------------------------------& G- g3 \7 M: ~# K" c% m8 E! f. J
  262.   # ● 按键被按下就返回true) i  R' h* N& k# H0 o
  263.   #--------------------------------------------------------------------------# X2 p+ G* V# O
  264.   def press(button)8 y' p: k; D2 R3 s& ?
  265.     case button
    # R2 u" \' P, h" z
  266.       when 0x01; return !@left_state.zero
    7 V( J6 U4 c3 [4 x! @
  267.       when 0x02; return !@right_state.zero0 ~% O% S9 `+ c( K, r3 J% p6 V$ O/ b
  268.     end
    9 L8 J( y3 g  W; S4 ^- s$ d
  269.     return false
    ( Z2 @6 j' e1 @/ J& G* B
  270.   end
    ! M' H' m& {+ t: [
  271.   #--------------------------------------------------------------------------) Q4 [4 [+ M! t! J+ V
  272.   # ● 按键刚被按下则返回true
    " A$ n! }: ^% i" c) r
  273.   #--------------------------------------------------------------------------) q9 V$ B- W4 ]! r; Z0 o* \
  274.   def trigger(button)* ]$ R5 V9 Y2 q+ d1 J4 L
  275.     case button3 O. Z3 T, ?. x( t3 r! U
  276.       when 0x01; return @left_state == 16 v! u  F7 j0 c7 @0 B+ i
  277.       when 0x02; return @right_state == 1, j1 Z0 d6 V# |! \* e5 M
  278.     end% q% _" r/ o" p4 f+ K& V/ {$ D
  279.     return false
    3 s, W: `' x7 i4 L
  280.   end
    / l0 V( U. `5 Z# j( ~5 S
  281.   #--------------------------------------------------------------------------
    5 B) S! [# C5 C. a, o) S
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true4 N! b/ K3 N: }* [9 b. @; u
  283.   #--------------------------------------------------------------------------* E9 i4 y# Y! N+ w( ^2 i
  284.   def repeat(button)/ R7 k! ]" a7 l$ h
  285.     case button7 a: O8 v; K* a. s: D8 s4 _$ Z- h
  286.       when 0x01; return @left_state == 1 + @( K* i) ~# Z' K6 R
  287.         (@left_state  22 && (@left_state % 6).zero)% y& R, n- \% u* w6 F
  288.       when 0x02; return @right_state == 1 3 _8 n5 v/ `0 q) @' K( C6 L
  289.         (@right_state  22 && (@right_state % 6).zero)/ U) G5 E. J1 q
  290.     end
    / v; t, O  t; {" V' j" J) @2 Q
  291.     return false3 P; R8 L8 V* r! c2 F4 x7 L3 O
  292.   end
    ; P  g) d0 ?  J  I1 l
  293.   #--------------------------------------------------------------------------& C6 l. F. u3 A! y
  294.   # ● 判断是否双击鼠标
    1 Y, S2 s1 H6 F+ ^8 m
  295.   #--------------------------------------------------------------------------4 L6 X% p# r- D1 ~. {$ A  t
  296.   def double_click
    & B: [9 }: h; d3 o  i4 A: f8 ]
  297.     @double_click7 y: P( Z& @2 Q5 Q3 F
  298.   end: u/ F' f! R8 N% Y4 s: U
  299.   #--------------------------------------------------------------------------  L$ [2 y8 Z. n; Y
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    2 l8 G* `$ E7 W/ F. m& H6 j( \
  301.   #--------------------------------------------------------------------------
    8 D5 Q7 P' N: Q3 O
  302.   def click_count
    # S6 I' J, B$ R$ n- I% a' U
  303.     @ck_count9 {0 x/ x( s+ l! k' L. B" J6 d# v
  304.   end
    $ w7 B* Z+ ]0 L7 j7 I
  305.   #--------------------------------------------------------------------------3 }' O; E& Y4 D+ m' {
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    ) Z* ~4 h7 s2 K4 g8 @. q
  307.   #--------------------------------------------------------------------------) s6 f% n! ~6 B
  308.   def left_state( S4 H% B" @% D$ r
  309.     @left_state" z, F1 U$ U4 q7 C  `+ `4 }
  310.   end
    9 i/ R# O4 |+ L3 ?
  311.   #--------------------------------------------------------------------------
    . w/ _: f7 g6 \3 k- l
  312.   # ● 获取鼠标的x坐标
    , m! x( p$ p7 H/ t7 [( S# x: o
  313.   #--------------------------------------------------------------------------" x0 L3 {! c3 _- v& [4 j. c
  314.   def mouse_x! q' D! i) o+ }: q4 L
  315.     @mouse_sprite.x  P6 f+ S6 m  s+ a5 C( B  N' J
  316.   end+ o+ G4 ^+ i; D/ l$ _4 \9 p9 D; E' J
  317.   #--------------------------------------------------------------------------+ U+ U5 {5 H- X7 e+ W
  318.   # ● 获取鼠标的y坐标/ r  ?# t& E3 _& l2 o/ t. U! S2 X
  319.   #--------------------------------------------------------------------------
    4 j# q8 P- e$ m3 `2 W
  320.   def mouse_y; }; o7 Z7 D; N% s) s0 [3 T6 o& |' k5 v
  321.     @mouse_sprite.y
    * K% X% e. ^- L- S
  322.   end4 ~& [2 w7 M1 [. k
  323.   #--------------------------------------------------------------------------8 L) f' X, @/ n& |: w" @
  324.   # ● 设置鼠标坐标: C( l' x2 J8 p8 W* j: J, S
  325.   #--------------------------------------------------------------------------$ `9 ?/ y! e6 N' v+ y" I  z
  326.   def set_mouse_pos(new_x, new_y)! j/ Q8 {4 C3 O
  327.     arg = [0, 0].pack('ll')
    ; w: S4 T2 o" }/ P6 x& f, {
  328.     Screen_To_Client.call(Window_Hwnd, arg)* z. M. r8 l+ }- e5 c: W, R
  329.     x, y  = arg.unpack('ll')
    ) Q2 v' x9 H. H& O  q* H
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    3 S7 t+ _* S0 p3 V
  331.   end
    $ @0 }  _7 T( N2 K! M/ A
  332. end #end of class  self
    ( m1 S: V# ~; Z) Y8 |
  333. ' H0 W/ H3 ?3 M2 ]/ B
  334. end. K1 `# C# J- T1 L
  335. & v# ~% U6 p/ A$ `
  336. #==============================================================================  b' M6 H3 r6 ~6 |9 }/ W
  337. # ■ SceneManager
    # {* j* R% f6 \1 A, }/ j. T1 r
  338. #==============================================================================3 U9 M5 z3 C8 e3 x7 I. t
  339. class  SceneManager, l% |3 p8 o+ D1 t
  340.   #--------------------------------------------------------------------------
      p& ~  q0 j$ L
  341.   # ● alias
    1 b0 v, |, }7 q- h
  342.   #--------------------------------------------------------------------------9 q( o) Z% m# U+ G6 b# T
  343.   unless self.method_defined(sion_mouse_run)$ N0 [7 W8 v: ?1 U5 e# I* g' s
  344.     alias_method sion_mouse_run, run: B) k( P& c6 U+ ?5 ]. l% f+ o
  345.     alias_method sion_mouse_call, call
    & D7 O* U7 y! g/ W0 f% u
  346.     alias_method sion_mouse_return, return
    * ~" j/ f7 _! E! e7 j6 d$ }
  347.   end0 K1 b/ n7 X. S
  348.   #--------------------------------------------------------------------------+ o! |; x4 x+ b& M9 X0 ]8 i* t0 E% C
  349.   # ● 运行0 V& y7 q& U6 `# J, p0 ~
  350.   #--------------------------------------------------------------------------
    * U% k5 Y" @  y! C# l: p
  351.   def run2 k* Q' _& i4 U& q( r+ d4 K
  352.     Mouse.init$ \; g9 H1 \. _2 x( G, q, @/ R8 g
  353.     sion_mouse_run& f; ^- ~6 D( \# M' `
  354.   end
    9 x2 d) v) [  j' R7 g, W  s: r
  355.   #--------------------------------------------------------------------------
    9 Q/ r% e& B. X) @9 g3 ]
  356.   # ● 切换
    + p2 e' q* c/ V; \9 \9 `5 M
  357.   #--------------------------------------------------------------------------
    9 e' O& r6 |( {9 ]3 P  @+ d
  358.   def call(scene_class)
    5 i( n* }7 x5 B# J* Y* K
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    0 d6 V8 v* ~% Q# F$ c
  360.     sion_mouse_call(scene_class)
    + G1 i3 v# Z  O: g$ M
  361.   end! c! o- T8 t) F0 D
  362.   #--------------------------------------------------------------------------
    0 L) X% h6 s0 {! s
  363.   # ● 返回到上一个场景
    " ?; Y. v: s& F, l
  364.   #--------------------------------------------------------------------------1 M( X. z7 `7 o
  365.   def return
    3 \/ v: B) u6 r3 \; V
  366.     sion_mouse_return
    3 G6 b$ e0 T' Y
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&( @) p4 {0 Y9 {8 }4 ^* z5 V& p- p/ K( @
  368.       @scene.instance_of(Scene_Map)3 y& u& k+ y& s* [$ P% `' ~
  369.   end, }6 o) A6 f# y5 f& A
  370. end2 r* m0 ?9 z5 ?" @/ j+ V
  371. 5 {9 Q  ~7 v0 q7 w; V* w7 C
  372. #==============================================================================! @% ~5 D' l4 v9 Y, B4 [9 y8 p
  373. # ■ Module Input
    ' }! C: K' ]: L+ Z
  374. #==============================================================================
    * z; A' i, d6 \' U, Q# I- t" h2 [( i
  375. class  Input- \6 A  e/ j6 ?
  376.   #--------------------------------------------------------------------------  }+ T: T9 K/ v" M! D. _) l
  377.   # ● alias6 t# f$ C! X/ p
  378.   #--------------------------------------------------------------------------
    - a$ O4 Q  l6 H8 i: a' G5 X* ]
  379.   unless self.method_defined(sion_mouse_update)$ C4 X% W: _% i& D( p* F) X
  380.     alias_method sion_mouse_update,   update
    % x0 E- g9 X, W1 Y$ @- N7 [' x
  381.     alias_method sion_mouse_press,   press0 d: `$ Q) h" q" h& Z" \' U6 i
  382.     alias_method sion_mouse_trigger, trigger
    2 V$ _2 G/ y, v: e* F' W% \4 K! }' a
  383.     alias_method sion_mouse_repeat,  repeat
    : u+ v! c" b: H5 B1 S& N
  384.   end
    7 u& `; o# }# Z
  385.   #--------------------------------------------------------------------------
    ) y$ c: a# h2 A: j
  386.   # ● 更新鼠标# c: y0 l0 ]) v% M$ M/ e5 ~, a
  387.   #--------------------------------------------------------------------------
    ! {2 B1 T* ^; u  x
  388.   def update
    4 F2 m9 M  S6 f
  389.     Mouse.update( t6 E& e, n% q; o9 T6 q0 B1 ]
  390.     sion_mouse_update- c1 O) t* z: v, c
  391.   end3 \. t# p! ]# a+ X$ y/ Y8 _6 i
  392.   #--------------------------------------------------------------------------0 ?$ c8 C4 L5 j+ z
  393.   # ● 按键被按下就返回true3 T* x7 r4 d- f/ s" F+ B
  394.   #--------------------------------------------------------------------------  B0 i1 w* @; `7 t' @
  395.   def press(key)) c$ e4 f5 U) S; l- c' t9 {
  396.     return true if sion_mouse_press(key)
    " ~9 l/ ]7 O) p. P" ^+ Y9 U
  397.     return Mouse.press(0x01) if key == C
    ! q0 T5 ~: x/ Y. J* S3 k
  398.     return Mouse.press(0x02) if key == B7 R  ~8 V5 M6 o, E
  399.     return false
    ' `( U& v! Q3 p' b  ^7 L) ^* c
  400.   end
    , ?( U0 n6 D$ j& {
  401.   #--------------------------------------------------------------------------
    6 h4 i5 W; g, u1 J; q/ e
  402.   # ● 按键刚被按下则返回true& n( p/ b: o% C' T* v  e  `
  403.   #--------------------------------------------------------------------------
    + o& U2 J  t; F9 g
  404.   def trigger(key)3 L2 N1 o; n+ V: {3 R
  405.     return true if sion_mouse_trigger(key)# X* G  ~- c: ^7 \$ F5 u2 O
  406.     return Mouse.trigger(0x01) if key == C
    ; r. E' B9 I* m7 W) \9 c6 z
  407.     return Mouse.trigger(0x02) if key == B
    ( D% ~9 c9 ~( k" }$ c
  408.     return false2 k4 h$ S9 f* I+ ~# o/ Q6 @$ X
  409.   end+ i: D8 X7 W: x: {/ b+ \, Q2 s; b
  410.   #--------------------------------------------------------------------------
    8 ~) A' u# M  Q5 j# E+ h- B
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true! i4 `* c. [3 s3 ^9 P8 [
  412.   #--------------------------------------------------------------------------
    & Y& {; Z. H& l2 }. h
  413.   def repeat(key)
      t6 x( Y& c/ c& L% R3 u/ n
  414.     return true if sion_mouse_repeat(key)
      k, i0 }5 [, R# ?% V/ m
  415.     return Mouse.repeat(0x01) if key == C3 X! a4 G7 [8 k, j( K
  416.     return Mouse.repeat(0x02) if key == B
    ( ?2 g" \: r0 C! U( r& _
  417.     return false
    # E8 ]; w, J  U: A+ e
  418.   end
    / u+ M' ?1 N9 U: D) H& d4 Y, G
  419. end
    ! b- ~$ g8 _5 d) }
  420. ; L( `2 b/ u/ q) J

  421. # O) S0 l% C$ u/ `( ~# `8 {
  422. #==============================================================================
    ! k* }0 R4 I( X; `' x0 X8 D6 i9 ^
  423. # ■ Window_Selectable
    + c* o) ~0 A) ?/ a& n8 a- n
  424. #------------------------------------------------------------------------------4 q$ n- U% `  y& C, Q
  425. #  拥有光标移动、滚动功能的窗口) |% o: M+ P& k' S9 a' M
  426. #==============================================================================
    ; Q+ ~! u* i" Z0 g
  427. class Window_Selectable: P7 o3 p. v5 B2 n% d: ]
  428.   #--------------------------------------------------------------------------# h: ]) |  H' v* x7 y5 k5 z6 Z
  429.   # ● 初始化
    . y4 w- B0 @: E1 a2 ?
  430.   #--------------------------------------------------------------------------# {) {+ Y" W5 x3 f* n5 x
  431.   alias sion_mouse_initialize initialize2 R9 ~! i. Q4 a' W; f1 _: E( I0 @
  432.   def initialize(x, y, width, height)
    + J8 P/ a  T$ C7 ^% L6 H% R* S
  433.     sion_mouse_initialize(x, y, width, height)
    0 c! I/ f/ E" I: I! M8 M: r( T0 p
  434.     @move_state = 0
    ( E. c& U# ]; F2 a$ {+ q; `  `9 |
  435.   end
    ! r1 W+ \1 F9 M6 {  G. M& K
  436.   #--------------------------------------------------------------------------
      L2 L3 \$ r- A, p: ^6 R# F- l
  437.   # ● 更新; {) |5 x. Z3 @  M# A6 b) M9 }
  438.   #--------------------------------------------------------------------------0 K8 H5 |; a& J0 k/ V
  439.   alias sion_mouse_update update- ?, F& v5 J* s) q) J& G
  440.   def update
    # p2 |0 \& ?. O) s4 ~  n
  441.     sion_mouse_update
    1 R  \, h  Q2 g' g' a  ]' x9 Z+ A
  442.     update_mouse_cursor0 @$ M) J- l  p& c: W% T
  443.   end
    5 n5 W/ I5 {+ u0 Q4 W- h
  444.   #--------------------------------------------------------------------------8 p9 C( D' _, A3 C3 F' A8 Z
  445.   # ● 启动后设置鼠标到index位置! H/ Z( y- J( y! I7 f2 e
  446.   #--------------------------------------------------------------------------
    ! I* y2 M4 H1 J" y: P0 N
  447.   def activate. A9 g6 G% ~# P
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    3 L5 h# g* U1 \, p
  449.     super
    9 [6 ~- ?# m8 q% j0 o0 s) P
  450.   end
    7 S% {+ @7 c* c( V/ K
  451.   #--------------------------------------------------------------------------1 x* y( f) f% S- y) o  t7 v# t& n0 H
  452.   # ● 更新鼠标和光标的位置+ R. p( |( u) A; @0 O5 P
  453.   #--------------------------------------------------------------------------& E/ D7 R7 d7 \7 H$ n5 `: A
  454.   def update_mouse_cursor
    ! z9 H8 \9 A. h' l1 [
  455.     if active
    % l, [7 n4 w3 B' ~" F3 g1 o# Q
  456.       if @need_set_pos+ n0 ]/ X2 [; ~8 @: N
  457.         @need_set_pos = nil5 u. C+ W: \7 V2 I2 D/ q
  458.         set_mouse_pos
    1 \4 C  }' m0 E9 Y) J4 x! k) b9 H2 D
  459.       elsif cursor_movable" b9 B* f! ]: G0 m. `3 C! B' K
  460.         Input.dir4.zero  set_cursor  set_mouse_pos8 t8 _# L) q# A0 g
  461.       end: S. h+ P' U: H/ t5 @+ O1 y# x
  462.     end
    " k9 r0 ?9 Y' i/ I" f
  463.   end. y4 L5 Z# [6 t
  464.   #--------------------------------------------------------------------------- q, L6 {% n' Q& H) ]9 F
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能' F# N* {' O$ V
  466.   #--------------------------------------------------------------------------3 t( r) Y4 U/ ]+ M) y% U# B0 l3 i
  467.   def set_cursor# M8 h5 i( c/ O3 g
  468.     mouse_row, mouse_col = mouse_window_area8 U7 s' `- {8 ^
  469.     if    mouse_row == -17 g) x- }. h2 G& ^8 \9 {# C
  470.       @move_state += 1 if need_scroll& C4 B& A- J3 F
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    5 V) f( p% G7 }- O8 |
  472.     elsif mouse_row == -2
    5 N" M% |$ V4 B) |
  473.       @move_state += 1 if need_scroll
    9 C% ?1 j! x7 n- l3 z: ?2 l; f. @# U  S
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    % K% T* |8 ]/ s
  475.     elsif mouse_col == -1
    0 X( {$ m: v0 l  ~4 y" K' Q
  476.       @move_state += 1 if need_scroll4 }  [: x1 `# C- w' b1 ?
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    0 K7 r+ T, S; l6 A- ]
  478.     elsif mouse_col == -26 y3 `4 I/ b5 I1 [, I
  479.       @move_state += 1 if need_scroll/ Q- ]' n3 R) B. s* e% J. u0 @. [
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
      x5 p" _6 y. ?
  481.     else- L+ I% z, |& ~' H( o3 w% Y* y
  482.       @move_state = 0! N; s9 ~6 D% r
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col% {, |" l: p0 J8 K2 r1 ^
  484.       select(new_index) if new_index  item_max && new_index != @index
    4 w, G" G- C1 O$ }
  485.     end7 P; ]% ]/ [' Y  O* p6 K% d
  486.   end
    * P( Y. o" P, H5 [
  487.   #--------------------------------------------------------------------------
    9 `+ o* g! a, t7 D" u
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    . h  B1 D% L9 L* Q' y+ c# {
  489.   #--------------------------------------------------------------------------: ^8 o5 m2 i6 w
  490.   def mouse_window_area
    7 D; p# }# ^! X; h
  491.     if viewport.nil # necessary!
    0 Q+ E: k) ^* W$ v
  492.       vp_x, vp_y = 0, 06 R; \0 F5 F. ~
  493.     else% G, Z7 b8 g: Y- E7 U' l
  494.       vp_x = viewport.rect.x - viewport.ox
    / ]" T' Y+ z. v! E  w
  495.       vp_y = viewport.rect.y - viewport.oy8 G7 Q0 q/ \3 w- J
  496.     end0 t/ b0 g; t% F, M3 u
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ; g4 C# [7 {# D$ t5 a  O
  498.     item_x1 = vp_x + x + standard_padding
    ( N, y3 c! C& m; I" @
  499.     item_y1 = vp_y + y + standard_padding3 z9 u* r! x3 ~+ f5 v
  500.     item_x2 = vp_x + x - standard_padding + width% `6 j/ S- H! \3 S( i. h- A( M
  501.     item_y2 = vp_y + y - standard_padding + height
      y( W6 V2 P% x) H; d6 x) G4 G
  502.     if mouse_x  item_x1) \9 Y6 J2 q  B
  503.       mouse_col = -11 b- R5 t3 }7 ~7 E' `2 Z
  504.     elsif mouse_x  item_x2
    6 `) t; ~$ h* H  S7 S& `8 o
  505.       mouse_col = -28 l" F, c$ Z& \7 B! N& k
  506.     else) h* s  O- o4 M& q+ `* s& y, n1 d
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    5 P1 b# z' J5 F$ q  K
  508.     end, C: Q: P' o! ?; T$ W
  509.     if mouse_y  item_y1
    ! H5 l$ Y# `" }5 v& p
  510.       mouse_row = -1
      d3 a& |! p$ H  t3 i
  511.     elsif mouse_y  item_y2$ j* R( t; J. e* E& A8 l3 |0 |
  512.       mouse_row = -28 e5 N' Q- W" B& U  ^% |& e5 }
  513.     else2 O$ X" y4 s! s" t( O% _. E
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    4 s3 U/ m+ d% i" E
  515.     end
    ) b; X+ [0 v0 {/ Z- s3 D! L: g
  516.     return mouse_row, mouse_col& d3 {  j# l8 L$ X  {% z
  517.   end
    ( v. V- j$ f* s7 ~" Z; P" y6 r# ~3 f
  518.   #--------------------------------------------------------------------------% r& b5 g9 C* r  f  p" C
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置$ D% x$ w, @" u3 f6 m. @5 k6 V
  520.   #--------------------------------------------------------------------------4 t* e) B2 k2 L6 e# v* R
  521.   def set_mouse_pos0 I0 L5 \. {% g5 z$ o
  522.     if viewport.nil # necessary!
    $ ]  T" E" H; T( {! X% F, }% x
  523.       vp_x, vp_y = 0, 0! q# I& d" N  x) h/ c. r- @
  524.     else$ A% H) b" j  B
  525.       vp_x = viewport.rect.x - viewport.ox8 ?  ]! l5 F2 |9 H/ D
  526.       vp_y = viewport.rect.y - viewport.oy
    3 D1 F5 ]0 z3 K: C- J4 r- ]' Q, z
  527.     end6 P0 J5 x( X* T. ?' g6 k& B; T
  528.     item_x1 = vp_x + x + standard_padding ! G: n% W  J5 Q: {' \( Z
  529.     item_y1 = vp_y + y + standard_padding
    3 D9 b$ n. P, a. H
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    ' X6 j8 ~5 C+ I3 {7 i
  531.     row = get_index  col_max - top_row2 c$ E6 e9 Z. ]- I
  532.     col = get_index % col_max
    ( Z: {7 o9 R: ?0 v0 u- D
  533.     new_x = item_x1 + item_width  (col + 0.5)0 l1 \7 ?5 ^# o, l: z; B, u
  534.     new_y = item_y1 + item_height  (row + 0.5)
    + c6 \+ Q9 Z+ _* _. y8 L' w
  535.     Mouse.set_mouse_pos(new_x, new_y)
    ; X; a+ t8 Y4 g: i
  536.   end
    " L# m- {! V( o
  537.   #--------------------------------------------------------------------------
    5 q/ V( W  R- ]  J+ l  n/ y
  538.   # ● 判断菜单是否需要卷动
    ; h& G  n' k( z5 r! \
  539.   #--------------------------------------------------------------------------
    . t' `4 [% Z* i3 o3 H- |" F
  540.   def need_scroll
    . c& c7 n: P" E' C; N- n7 `5 D
  541.     item_max  col_max  page_row_max
    & e8 F' R+ m1 N4 y, e* c" Z0 z% a
  542.   end" o) |+ l" x7 L9 k% C
  543.   #--------------------------------------------------------------------------# R% q& k: ^! m7 f* X
  544.   # ● 判断是否为水平卷动菜单
    2 x4 S2 I7 @8 G% t' w8 c, Q
  545.   #--------------------------------------------------------------------------
    ! Q; D2 x! w" y* e, u+ H
  546.   def is_horzcommand
    6 g) ~+ V  P- q+ w
  547.     return false2 Q8 Y, X5 E7 V  Z  G, w
  548.   end
    ! {" R3 }2 m$ J& l
  549. end
    , k5 h5 q0 q: m  ]) l# ~
  550. ( ?6 W/ N1 }( [
  551. class Window_HorzCommand1 Q) [4 O: ]/ T( W/ I
  552.   #--------------------------------------------------------------------------3 ~2 e4 F$ T$ D7 q% j5 e) r
  553.   # ● 判断是否为水平卷动菜单
    4 M4 x$ X: R. N7 [% t* B
  554.   #--------------------------------------------------------------------------4 J; J- |7 [7 D' A- D- U  J& Y
  555.   def is_horzcommand" `5 A6 C5 L' {6 F
  556.     return true
    0 H  Q6 C- b5 v/ l' T: @4 [$ f: A( M
  557.   end: l4 g- Q7 e/ L4 O7 B/ C0 n6 ^$ e
  558. end
    . M: f9 T( ^& Z# r7 N
  559. 0 v# Z: f9 \, |% i0 b
  560. #==============================================================================
    + r# w: X: q; a
  561. # ■ Window_NameInput
    0 w( V& o0 K$ B  s6 H1 Z$ W0 {
  562. #------------------------------------------------------------------------------' p  I5 Y7 h* l, c* v
  563. #  名字输入画面中,选择文字的窗口。
    ; W5 R) R% l. O2 h
  564. #==============================================================================  L% t( S. f/ n2 m
  565. class Window_NameInput
    3 a! c& T( h- o/ y9 v, ^* ?* q# M
  566.   #--------------------------------------------------------------------------% Z9 x. o! q" E1 p' J' |
  567.   # ● 设置列数
      s  }; e2 {$ G* n4 L4 B
  568.   #--------------------------------------------------------------------------" z  d( c$ L  D4 [" d$ _+ W
  569.   def col_max# a# D+ e' v( m1 Z
  570.     return 10
    7 z9 ~/ H: N+ V; Q
  571.   end
    ( |- v! F5 r9 n! z
  572.   #--------------------------------------------------------------------------
    2 P1 t8 L4 E" |
  573.   # ● 设置填充的Item个数
    * \. z) l/ k( s( m
  574.   #--------------------------------------------------------------------------) A) `5 k1 P: y. r
  575.   def item_max
    ( [, i9 d9 c; V) v
  576.     return 900 C  G: `( P. U# b. H$ t" c. h& w
  577.   end1 f2 ~9 y) f$ Q+ f. Y8 u6 I9 }. R5 g; n
  578.   #--------------------------------------------------------------------------, {) I- _) e7 n0 g. Q+ G5 X  K
  579.   # ● 设置填充的Item个数
    , g/ f' y. W, ]* ^) e
  580.   #--------------------------------------------------------------------------
    & z4 Q6 i: @* n  |  }5 e0 Z" m
  581.   def item_width
    . _: q3 Y  _4 t  }7 L7 b- o; X% T
  582.     return 32
    9 p  `; h- \: Y# H9 j# T, I+ ~
  583.   end
    & h. D6 G/ l7 ^% g4 o
  584.   #--------------------------------------------------------------------------
      W; u8 R6 z+ j5 J$ @5 L" ^
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    ' t+ M1 L) Z; m0 X# Z
  586.   #--------------------------------------------------------------------------
    0 a  Y4 ]1 D! s' V6 U$ h( p- N
  587.   def mouse_window_area
      V9 I+ M# E" J% @
  588.     if viewport.nil
    ! r' {: b* c# B; L5 D5 Y
  589.       vp_x, vp_y = 0, 0
    ! }5 m& ~6 @2 U5 r6 W% v% G, ^
  590.     else% i+ g4 i: E2 {" F( q9 r% U
  591.       vp_x = viewport.rect.x - viewport.ox$ p# c, \9 i/ i7 \' [  Y* w" e
  592.       vp_y = viewport.rect.y - viewport.oy: a% d* k! b& C, g
  593.     end
    : v+ x$ _3 n/ N" _' L8 {; {' R9 f
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y0 R1 q8 z  g7 E/ W* W! |
  595.     item_x1 = vp_x + x + standard_padding
    & n+ u! p& ~+ L1 S" {
  596.     item_y1 = vp_y + y + standard_padding
    5 l0 k  O" o. h! j. r8 s
  597.     item_x2 = vp_x + x - standard_padding + width3 V' Y1 @, w4 P8 z/ }0 D' i
  598.     item_y2 = vp_y + y - standard_padding + height
    + k9 F$ S+ Z7 t* Q3 N
  599.     if mouse_x  item_x1( L, }, w) d4 ^; u$ D' D
  600.       mouse_col = -10 {. h. _) P% w' t, t7 p
  601.     elsif mouse_x  item_x2
    3 |2 l' F/ ?$ D: y
  602.       mouse_col = -2
    * u( V- L5 A% n7 v! M
  603.     elsif mouse_x  item_x1 + 160) B5 ^4 v+ {- @% _7 S7 R! c
  604.       mouse_col = (mouse_x - item_x1)32
    : O8 z% `' q2 E( Y; z
  605.     elsif mouse_x  item_x2 - 160+ W0 V; j% B( M& c
  606.       mouse_col = 9 - (item_x2 - mouse_x)323 x/ @: }2 p5 e7 c% I
  607.     else
    $ e4 ]9 f/ p5 M8 O6 j; a
  608.       mouse_col = mouse_x  x + width2  5  4  ?4 f* Q$ N3 d. }7 h1 x" B, R' H
  609.     end
    ( W  b- C& k; l7 z* G9 B
  610.     if mouse_y  item_y11 I# n6 Y* J" f) @( q! j
  611.       mouse_row = -17 }8 o* ?8 a$ |9 Y' z# v4 E
  612.     elsif mouse_y  item_y2
    0 R6 H, Y& `, G, A' w
  613.       mouse_row = -2* C( q- @0 D1 m8 F! z, {- ]
  614.     else
    9 u# R+ e5 n+ r
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)' |- _2 w4 g  F5 W* \
  616.     end& ~: g8 Q# y8 x( \0 x  _! q9 U0 f
  617.     return mouse_row, mouse_col5 r, O. c' j* G" S  X
  618.   end" u6 w' Z6 m7 t5 \( W9 Q
  619.   #--------------------------------------------------------------------------# d- D/ y( v# \7 R' v& r
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    / @3 C" [" ?# N5 G( l
  621.   #--------------------------------------------------------------------------
    ; y% J( T* A: r% P" a8 V
  622.   def set_mouse_pos. b& I& _! Q- C
  623.     if viewport.nil # necessary!$ K* w8 z* d; z# c) d% U9 i1 T' I
  624.       vp_x, vp_y = 0, 0
    - F2 \1 V& K! x9 G7 K
  625.     else6 V0 t% U5 Y4 E) f
  626.       vp_x = viewport.rect.x - viewport.ox6 X4 [; V8 Y+ J2 G
  627.       vp_y = viewport.rect.y - viewport.oy; Y( i- l3 R# x& }0 n5 A$ p/ u! ^
  628.     end
    3 ?* M- F; y- z! O
  629.     item_x1 = vp_x + x + standard_padding 0 b% Q2 }$ c9 A. n
  630.     item_y1 = vp_y + y + standard_padding
    ! \# t* Z1 [8 L6 S. p2 q; a
  631.     get_index = @index  0  0  @index
    / l. Z& E, L$ r% o+ O+ U9 D4 f- m
  632.     row = get_index  col_max - top_row
      ^1 L; ^! k, a
  633.     col = get_index % col_max! f* x# P0 S) M1 b0 ^6 E
  634.     new_x = item_x1 + item_width  (col + 0.5)7 b! }' x6 Q- k9 H/ M; z
  635.     new_y = item_y1 + item_height  (row + 0.5)
    5 c" y& b5 W5 B3 l& I$ E
  636.     new_x += 14 if col  43 @5 W& w  ^/ d( |
  637.     Mouse.set_mouse_pos(new_x, new_y)
    ! j* D8 L" M5 Q0 O7 |+ [
  638.   end- d( f' h* C7 o$ W. y
  639. end  E4 }9 b8 y% B0 O. O

  640. - r0 W* J9 {5 ]: ]
  641. #==============================================================================
    4 O* I7 w0 h# r, x1 t
  642. # ■ Window_NumberInput4 F+ D4 ^& a6 N1 x
  643. #------------------------------------------------------------------------------
    1 c% L2 G( G8 k0 a& b
  644. #  重写了数值输入的方法以适应鼠标
    ' Q/ Z! R# f  f& o. B4 }
  645. #==============================================================================+ {) B! G* Z' j
  646. class Window_NumberInput  Window_Base9 _0 f# @8 p5 _9 m- u8 R
  647.   #--------------------------------------------------------------------------( n/ k, ?3 E2 e7 U1 u
  648.   # ● 定义实例变量
    . G; r' Y* m% }. V
  649.   #--------------------------------------------------------------------------
    * t7 E4 i/ s4 A" d9 K% g' D
  650.   attr_reader extra_window
    0 A. \/ B8 N" `" Y% a
  651.   #--------------------------------------------------------------------------! ]% M6 K, D" g# }5 S
  652.   # ● 初始化4 e& n- c; ^6 U% [  e0 X
  653.   #--------------------------------------------------------------------------( U9 O, u8 W: J" Y* u6 y$ K
  654.   alias sion_mouse_initialize initialize
    : c3 x! f  ~, V6 _+ H( L. C
  655.   def initialize(arg)
    7 q+ X' g( h+ M6 J( D' F2 s
  656.     sion_mouse_initialize(arg)3 T* U+ B. t* }! p9 @& d
  657.     create_extra_window
    ) M( c" s, Q7 V& `: i& n/ t: P
  658.   end9 h' U' f. Y1 P- ^$ o' J; e
  659.   #--------------------------------------------------------------------------) h- W" A" O0 X& w* o3 H. y+ Y
  660.   # ● 启动! o/ r3 _7 v9 d3 V1 I& q
  661.   #--------------------------------------------------------------------------9 {+ D: ~5 J0 D- y. k% L) @2 _
  662.   alias sion_mouse_start start3 i# z* W9 y; ]/ ~7 V# }: H
  663.   def start' B! _+ f) \) ~0 l' N, x
  664.     sion_mouse_start! y: D2 t# _& L. |( E
  665.     deactivate. f, ?! s* X  A2 K2 M  |3 h
  666.     extra_start
    5 l& G) v. u2 b0 \
  667.   end
    ( x# M; W' g! @4 m3 p2 n
  668.   #--------------------------------------------------------------------------. p3 R; @) D2 p
  669.   # ● 创建新的数值输入窗口
      E5 |7 t) l- l+ l) L, W0 i2 S3 n
  670.   #--------------------------------------------------------------------------
    0 v9 |- t' f* `/ o: ?. T2 M& _
  671.   def create_extra_window
    6 X1 [/ y! s- b
  672.     @extra_window = Window_NumberInput_Ex.new! a; E$ g4 }& E" U9 B
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    . B* r, R- B) h( D
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    0 C5 R7 y- d# u+ X5 b
  675.     @extra_window.index_proc   = Proc.new {n @index = n }3 u5 f9 D2 E# i3 W) B' l8 K
  676.     @extra_window.close_proc   = Proc.new { close }
    ; `9 S+ v2 t* w8 k' U2 f
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    . Q; c, H  c+ U" I5 m" A
  678.   end' ^9 ?9 a( {- ?; l+ S
  679.   #--------------------------------------------------------------------------) [3 E! M3 \/ N+ O+ E
  680.   # ● 激活新窗口
    , N. |" }7 L6 i' S2 f" F
  681.   #--------------------------------------------------------------------------
    , l' @* L* v1 N1 ~) O% u
  682.   def extra_start
    1 [' s( u7 n; \+ k8 T9 q' m
  683.     case $game_message.position/ E6 V* h/ c) o. r
  684.       when 0; @extra_window.y = y + height + 4( C  t# O1 L3 _& X
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    ; a. C+ l# u8 T# @( X& I
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    : Q5 V$ {7 j8 V3 S% N% `
  687.       else  ; @extra_window.y = 83 k# r- j$ c% l6 G% l( y; L# g6 h
  688.     end
    7 H8 x0 z$ [( l3 C; y. A
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    / M8 x% Y2 v' a0 W3 p3 T
  690.     @extra_window.digits_max  = @digits_max' N/ q) n6 ^; k" G6 x
  691.     @extra_window.number      = @number4 U2 s, r. O2 O( x- n) x4 J3 f
  692.     @extra_window.open: y) F7 C# ~, l( V3 n$ v, \
  693.     @extra_window.activate
    ( p2 \) R1 m( F0 @' ]/ d9 Q
  694.   end
    9 \5 l3 w( v4 ?+ P- l
  695.   #--------------------------------------------------------------------------
    - f! G% Q! K# q; P. V
  696.   # ● 更新. J, L# \" M1 x3 N
  697.   #--------------------------------------------------------------------------
    ; M5 E* d2 I8 {' j) `
  698.   def update
    + Z: o: G. q! I, Z2 Y2 q+ O+ [$ i
  699.     super
    4 l: `4 G* h( Y2 G- W
  700.     @extra_window.update
    " j( B* B3 S. E
  701.     update_cursor
    3 v- ?0 R* ^/ i6 Z' l
  702.   end
    9 K# c- h. J2 L: j9 p0 }4 p3 A* w
  703.   #--------------------------------------------------------------------------* D. g, M( m2 M7 w
  704.   # ● 关闭窗口! E! a; e, Q: \
  705.   #--------------------------------------------------------------------------6 `) I) |9 `1 J5 l0 p' T- R
  706.   def close! k, M; b3 m' S3 D4 f' b4 R' o
  707.     super
    - |- e$ H% r1 F" C$ l  B
  708.     @extra_window.close
    , n. [! m$ l' ?, ^; h4 y
  709.     @extra_window.deactivate
    % C* a0 _6 z4 {* C
  710.   end2 U% d( \% T0 o' {1 M2 |
  711. end2 N' Q# H0 V$ N, j* M% d

  712. 9 l6 @6 n0 E9 [
  713. #==============================================================================
    / x$ X6 B1 g+ N( E" ^
  714. # ■ Window_NumberInput_Ex) f( A3 ?; p; T* ^& z
  715. #------------------------------------------------------------------------------
    - g% r/ i' `( ~2 W' |
  716. #  新的数值输入窗口(NewClass)
    + b4 W" z2 T$ E
  717. #==============================================================================
    ) |7 k) s# ]; H
  718. class Window_NumberInput_Ex  Window_Selectable
    ' Z5 F; S1 {0 C
  719.   #--------------------------------------------------------------------------! v7 t. |% X+ {, b
  720.   # ● 定义实例变量  J) P# C) |1 {) j
  721.   #--------------------------------------------------------------------------1 Y0 k4 Z  I) d4 F
  722.   attr_accessor number_proc! i# k2 {: }7 f1 l8 y# ~
  723.   attr_accessor index_proc' v4 w; Q; B* b: \  X# k
  724.   attr_accessor close_proc% H' s  k' m* ^, U5 F
  725.   attr_accessor refresh_proc6 D% C% K  y9 h( t* V: w
  726.   attr_accessor number" V6 I# @- \8 O- V, Z" a! E+ S( T
  727.   attr_accessor digits_max1 A6 L( |8 V8 _% `5 f9 g! {. b
  728.   attr_accessor variable_id+ [# z* }, L/ O/ t
  729.   #--------------------------------------------------------------------------
    . ]# a( B- D6 o( R3 T
  730.   # ● 数字表
    " S5 {2 ]4 Q' w0 i* x! v
  731.   #--------------------------------------------------------------------------
    . N; a% w3 _, Q% E: ?4 l
  732.   TABLE = [  7,  8,  9,: ?0 Q, I! K2 I/ ?$ _7 d% f+ |# a
  733.              4,  5,  6,4 o% m9 ]( i" z: o  g
  734.              1,  2,  3,
    ; l7 ~: S% _/ X1 g# K5 e
  735.             '←',0,'确定',]
    - h2 S' ~9 w' u# y
  736.   #--------------------------------------------------------------------------. N# |! r  y5 ]- v1 o9 W1 [( {9 Z
  737.   # ● 初始化对象# z. n' ^( H( E. i/ `6 R
  738.   #--------------------------------------------------------------------------
    5 S* m' n- l' i0 d; ^
  739.   def initialize7 y5 r0 v) K+ W: o4 v
  740.     super(0, 0, 120, fitting_height(4))
    0 e5 C4 W/ l  c2 B
  741.     self.openness = 05 W6 D8 K9 |/ \
  742.     @index = 0
    8 w7 q2 p7 a" W6 O& {* d# @
  743.     @number = 0* C9 ^1 _8 ?8 C, s) U$ ]
  744.     @old_window_index = 00 t1 X/ C- a* J
  745.     @digits_max = 0: E9 J  u% B6 }- i
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }& P1 m' m! I9 V) _5 v
  747.   end8 Q! V: z  h, U6 a0 y% [3 V0 \
  748.   #--------------------------------------------------------------------------5 ^( u# ~, s1 ~' p. |8 W9 x
  749.   # ● 获取项目的绘制矩形8 Q7 S2 R# O$ B5 i% k+ B
  750.   #--------------------------------------------------------------------------
      W- `% ^  T1 ~; m+ J. }1 D* Y
  751.   def item_rect(index)
    8 q: I$ K4 r8 S: _8 U3 q1 B
  752.     rect = Rect.new$ H8 ?# O: B# _* \7 z; ]
  753.     rect.x = index % 3  32
    " I3 U( U' y( E9 h
  754.     rect.y = index  3  line_height  u1 h' @3 Q7 \) ?% p
  755.     rect.width = 32: o1 P7 B! X* u, A/ y' b3 c
  756.     rect.height = line_height- I( z+ Y) U- W/ e
  757.     return rect
    * u0 r4 k) v5 J; ~8 B- Y  K4 c  _9 A
  758.   end# f+ E: x  D+ j, J, M
  759.   #--------------------------------------------------------------------------
    / u+ |7 [1 l2 L$ K
  760.   # ● 将光标设置到鼠标所在的位置/ S$ c! K9 \. E" A
  761.   #--------------------------------------------------------------------------% ]' \; A" _5 |8 |
  762.   def set_cursor/ k+ N+ ]& R! T: e, U; U3 V
  763.     mouse_row, mouse_col = mouse_window_area
    $ s" O) E, R( r4 T" r) r
  764.     if mouse_row = 0 && mouse_col = 0
    6 r6 M& V7 b1 X3 J; h
  765.       new_index = mouse_row  3 + mouse_col, @& M/ P2 F* l9 t* j- f# z
  766.       select(new_index) if new_index = 11
    ( ?/ p8 {, U/ P% H/ O
  767.     end
    ! |  i$ S; F3 d' A5 }% d
  768.   end6 T. J% W; x& \- }
  769.   #--------------------------------------------------------------------------
    # F! U* d# i, D5 N5 t7 E/ u- I0 Y
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    2 s+ n1 t, d4 V0 v1 i9 e" S
  771.   #--------------------------------------------------------------------------
    ' K( a8 @7 _' W, U0 S! J+ c* w
  772.   def mouse_window_area; X: I: E( |! o5 W* E, C" J( c
  773.     if viewport.nil; b& B9 [0 e; X
  774.       vp_x, vp_y = 0, 0" X* o4 g4 [, D, T/ p4 C" I
  775.     else
    3 p; N. a. S8 i9 b* r3 P  L
  776.       vp_x = viewport.rect.x - viewport.ox
    0 S  K& U9 s7 K
  777.       vp_y = viewport.rect.y - viewport.oy. |" n8 R& k0 _! V. U) U; z2 a& N
  778.     end1 u1 k6 u# |8 N4 I% \* m  N" d
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y7 v! E6 ?- L4 N2 x) z4 m
  780.     item_x1 = vp_x + x + standard_padding 2 ^7 @: `" s" q+ j- I* U
  781.     item_y1 = vp_y + y + standard_padding
    % ?- B; k! |7 Z' y
  782.     item_x2 = vp_x + x - standard_padding + width
    4 j; v4 m, j5 `2 S% |
  783.     item_y2 = vp_y + y - standard_padding + height
    , ]4 w/ @1 W  x
  784.     if mouse_x  item_x1
    ( ~* P3 J" J4 g* u  E
  785.       mouse_col = -1( v0 T6 Y' H& @. w# c( c
  786.     elsif mouse_x  item_x23 E" M: G; q+ l9 w) M; O$ |7 h+ R
  787.       mouse_col = -2
    2 I4 N. V$ V2 T# M0 }
  788.     else
    ; N* h' C0 l" R; O1 Z
  789.       mouse_col = (mouse_x - item_x1)  32
    $ k" p  F2 Q' N+ J& |+ b
  790.     end
    $ f. K7 X' Y* m, Z& f
  791.     if mouse_y  item_y1
    & L2 ]7 [5 D) s  B  _5 r: z
  792.       mouse_row = -1
    8 q9 f. U4 {$ _( U
  793.     elsif mouse_y  item_y2
    1 h. H  Y# M0 I! M) P
  794.       mouse_row = -2
    0 N% Y, @  |: l; g' Q0 R
  795.     else
      ^  a1 y6 }# {* u& \) H
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)7 _& p% t7 w( v# q% @
  797.     end
    ! S  f3 h+ I6 C8 @& ]1 m
  798.     return mouse_row, mouse_col
    , o) S$ W1 Y" z$ \7 h
  799.   end
    % y9 P& U3 g- J
  800.   #--------------------------------------------------------------------------
    8 }, h7 o4 g- s
  801.   # ● 获取文字
    8 [; L% w! m$ R0 k) v
  802.   #--------------------------------------------------------------------------
    - c& `) @! p0 O8 {, y
  803.   def get_number
    0 V" k. ]7 ]! A5 m
  804.     return false if @index == 9  @index == 118 E4 q2 d0 V! v9 s# L! n
  805.     return TABLE[@index]
    " {7 V) |2 f$ A# x0 c. H9 B6 U
  806.   end
    . r: ^$ i! i5 K% f( t/ x
  807.   #--------------------------------------------------------------------------5 S* e* O( U% R3 C9 d$ m
  808.   # ● 判定光标位置是否在“退格”上* d4 r4 u5 I/ A+ n0 `, J
  809.   #--------------------------------------------------------------------------, \5 A5 E" G  B1 S! H
  810.   def is_delete- Z! W1 U) }1 K2 V; p
  811.     @index == 9
    . Z* ?6 x2 ]" N- P+ n! ?! Y
  812.   end
    ; @* `8 o! R& J2 B/ `7 u0 n
  813.   #--------------------------------------------------------------------------; q6 k* E/ u& a
  814.   # ● 判定光标位置是否在“确定”上* T4 m, `+ j2 u) v$ ~* P
  815.   #--------------------------------------------------------------------------
      U. J9 W; c6 t1 N2 _1 D
  816.   def is_ok
    2 Y) A* T. _2 m; F
  817.     @index == 11
    ) I# z6 _4 [  ^- d/ k6 a6 Y+ w9 K
  818.   end
    - K4 E( ]- C0 s2 N
  819.   #--------------------------------------------------------------------------  D* m5 T  l3 n* }, N  v0 O* s
  820.   # ● 更新光标& A# N, B* Z4 ]% _) O0 a+ y6 L) o
  821.   #--------------------------------------------------------------------------
    / z* W+ \2 Q  S5 m9 t; v
  822.   def update_cursor
    ( L4 n% |. K( z9 ^7 @
  823.     cursor_rect.set(item_rect(@index))( V: M: Q( C$ y! _# d
  824.   end% t/ E: ^/ B  I
  825.   #--------------------------------------------------------------------------9 b" Z3 q7 a# O1 P$ x* v7 ?
  826.   # ● 判定光标是否可以移动% o5 g# E) Y* l3 z- s+ G9 C
  827.   #--------------------------------------------------------------------------" |+ s2 ]# W+ z7 A
  828.   def cursor_movable0 j5 M+ U: g3 U3 G2 j4 m
  829.     active- v8 j* R' M+ p* L
  830.   end3 l" l6 i( L0 Z- v
  831.   #--------------------------------------------------------------------------
    . e& H+ V2 V( |& ?
  832.   # ● 光标向下移动! b$ b( p. _4 k7 F' E
  833.   #     wrap  允许循环: y) ?& \" B: u& Z7 T. L
  834.   #--------------------------------------------------------------------------
    ( P5 C3 F# R4 V. u; h
  835.   def cursor_down(wrap)
    1 k8 Y/ x9 k$ F; J: D' ?
  836.     if @index  9 or wrap
    & ^; V" Q& `! J) t0 {$ m  N% g
  837.       @index = (index + 3) % 12
    8 i# u* ^8 T! L; `
  838.     end
    , d  W. k  M8 m6 U& N6 [" B2 k
  839.   end
    ( b$ x) B7 j# c' V& B0 F7 _
  840.   #--------------------------------------------------------------------------
    9 P: R  C& t8 J, o: ~4 i' h7 K
  841.   # ● 光标向上移动
    - H2 S& e( Q; }3 H
  842.   #     wrap  允许循环
    # w" H( w+ Z: M0 ?. k8 [1 v
  843.   #--------------------------------------------------------------------------2 {% E5 l2 L+ n
  844.   def cursor_up(wrap)! [( V2 d/ N  Z& B" G; T
  845.     if @index = 3 or wrap. j) P) M: P0 q
  846.       @index = (index + 9) % 12; _$ p% u# I: l* f
  847.     end
    : G2 E2 ?$ O# R/ f
  848.   end  i0 L' b$ c5 j' X4 u) p& W% n) W
  849.   #--------------------------------------------------------------------------" s# d; m- F9 k5 w- c3 {# i/ h
  850.   # ● 光标向右移动7 F6 g- u+ \) t+ K0 c. {, `
  851.   #     wrap  允许循环
    $ `, ^3 J2 r$ S& a  z
  852.   #--------------------------------------------------------------------------* J1 z/ w/ A  N2 r+ h9 \; O7 Y% R
  853.   def cursor_right(wrap)) w4 h! |0 ?) Z' u& i3 o/ L2 q
  854.     if @index % 3  2! c8 {) h; g* R5 B- U
  855.       @index += 1, ]+ h$ W# }8 O. D7 i6 c/ r
  856.     elsif wrap
    " D$ b& o( g- o! P+ T* B7 ~
  857.       @index -= 2
    0 N& i" o5 L( P5 A4 L9 r' \7 I
  858.     end$ U* \# w8 Q- _- Y9 f# E4 Q
  859.   end
    % U, i2 m1 i. Q. ^% d
  860.   #--------------------------------------------------------------------------& x! ?1 ]$ P5 `9 j! g- a! w9 F7 I
  861.   # ● 光标向左移动
    $ P8 W. C5 l0 ^7 j  f$ w
  862.   #     wrap  允许循环# t3 ?7 e: M$ X2 r4 I" b  e7 ^- A
  863.   #--------------------------------------------------------------------------6 F! y" w, w; X* t3 ~4 U. Y
  864.   def cursor_left(wrap)
    ( d4 J( u. K( f- H# f
  865.     if @index % 3  0- R* l+ H. b1 l8 I
  866.       @index -= 1
    & N( @' G; P7 }7 Z7 O! |* F" h
  867.     elsif wrap4 W7 a: v- G, v+ e  ^
  868.       @index += 2- O$ f2 I; w4 e# M
  869.     end
    1 }' [; M% ~; |
  870.   end
    + J+ E- @' V# l
  871.   #--------------------------------------------------------------------------! b4 J& ?% y7 |$ M+ w8 k
  872.   # ● 处理光标的移动, ?4 ^- u' _; G  U
  873.   #--------------------------------------------------------------------------% A! R# j& u2 m0 c. @
  874.   def process_cursor_move( J% M5 Y/ I5 E) `
  875.     super
    : K5 I. b" z" Z$ P
  876.     update_cursor) h& d  g; u+ \7 e& y7 w: v
  877.   end" S0 W" `  H0 E1 m& }
  878.   #--------------------------------------------------------------------------
    5 o- \  w- ]7 J2 u6 {" p. k
  879.   # ● “确定”、“删除字符”和“取消输入”的处理3 t4 n% y' E  Q1 ?7 m
  880.   #--------------------------------------------------------------------------
    ( ~' l8 G: _& O7 Q' ]
  881.   def process_handling- Y& Y% Z0 A" A* W
  882.     return unless open && active
    5 ~+ m5 k( G0 f/ c1 P
  883.     process_jump if Input.trigger(A)
    ' m- {: n! u& ?5 M$ s
  884.     process_back if Input.repeat(B)* ]  f8 o& l% t$ L- d* W0 z. v
  885.     process_ok   if Input.trigger(C)9 G! S8 ?/ I, ]* P0 `  ?
  886.   end( h# ]* _: D: {
  887.   #--------------------------------------------------------------------------
    , \  O  B" u4 Y& L
  888.   # ● 跳转“确定”
    / N/ C8 v2 l% R7 x
  889.   #--------------------------------------------------------------------------
    # r3 k% y+ `; _
  890.   def process_jump; F: T- L% h" B$ W
  891.     if @index != 11
    $ O1 {/ g% d& f. p  i" Z
  892.       @index = 11
    $ J- Z. h" ]' c1 H' J
  893.       Sound.play_cursor3 b/ u0 `/ Z+ A% `; g9 y+ I
  894.     end
    4 H* }/ P3 b! A
  895.   end% O$ j$ \* w. b8 }( e/ x& r' v
  896.   #--------------------------------------------------------------------------0 `- g4 y& s/ D3 l# Y# y$ k
  897.   # ● 后退一个字符  }% I' z+ B; n. y/ M$ |& p
  898.   #--------------------------------------------------------------------------
    % J( M% ~6 x% o$ s# Y
  899.   def process_back# }* A1 Z  I; u& D# ~2 }  N" T3 I7 b1 s
  900.     Sound.play_cancel
    - M$ h/ H1 T; C
  901.     place = 10  (@digits_max - 1 - @old_window_index)6 Y) ^- b' g. C6 `% s3 {$ ~
  902.     n = (@number  place) % 10
    & }# H6 v. V4 `! D( H1 H
  903.     @number -= n  place
    ; h# B  g9 W$ |
  904.     @number_proc.call(@number). L! k% E" X- S, z; h0 U# x
  905.     @old_window_index -= 1 if @old_window_index  0
    8 J6 y* U( M# T( a0 o9 \& u
  906.     @index_proc.call(@old_window_index); r; z' c4 S% \9 B' V
  907.     @refresh_proc.call
    9 j  X, G1 t% f$ |
  908.   end+ H% {' d! @; f# j
  909.   #--------------------------------------------------------------------------
    ' w+ R8 k& ^% I0 V, v
  910.   # ● 按下确定键时的处理
    3 y& y! w! P: m, |; |
  911.   #--------------------------------------------------------------------------. h; Y* T5 t' w4 T! n8 l8 y- s# f
  912.   def process_ok0 L/ U0 O4 M, a8 E" W) p9 X; k5 C
  913.     if get_number2 u. [$ l- m+ N, F# s. k
  914.       Sound.play_cursor/ T! Q# o7 P2 z% Q* W; `
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    # p1 F/ \$ j7 _" U& V$ K" V$ a
  916.       n = get_number - (@number  place) % 10  S+ v. b! d7 j% s# i% Y7 C
  917.       @number += n  place1 s5 P6 u" O! ]/ I& |8 V& |/ G
  918.       @number_proc.call(@number)
    ; V+ D7 p5 Y5 q4 K. L
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    : _5 t' L9 [9 c
  920.       @index_proc.call(@old_window_index)
    / |) [% o: d9 O" D
  921.       @refresh_proc.call
    4 i& W  K& ?+ N0 ?9 i: X
  922.     elsif is_delete
    6 M- v7 o8 a1 D" X
  923.       process_back$ {/ t3 |; T" T! N! r3 {0 W/ L
  924.     elsif is_ok
    + S2 x6 x# Q5 E- `
  925.       on_input_ok
    - x7 O% D& a& Z! C
  926.     end' ]8 c- g9 C7 G' M
  927.   end
    % j/ k2 x; C: S7 C7 h" `$ m
  928.   #--------------------------------------------------------------------------
    $ J1 a0 s& ^, {# p# J
  929.   # ● 确定* |2 e% x2 n1 y' ]
  930.   #--------------------------------------------------------------------------, v8 R  E5 \7 l' Y, \# A
  931.   def on_input_ok
    - d3 B7 n2 `; v: X" e- ^
  932.     @index = 0
    ) b/ [) I/ h0 @1 {
  933.     @old_window_index = 0, A9 F' q# H: D
  934.     $game_variables[@variable_id] = @number* B$ N0 d) V0 z2 m( R2 ]& E' }
  935.     Sound.play_ok/ X+ q4 n- M9 P
  936.     @close_proc.call
    8 `; _& g8 b7 }2 H, |$ b
  937.   end0 u- W$ p. J. C4 k! l$ R( i9 y& ]
  938.   #--------------------------------------------------------------------------
    % U  I+ x9 ]2 J
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置  R- i8 i; {  Z
  940.   #--------------------------------------------------------------------------: P" y8 r' ?6 N  E/ g/ q/ B
  941.   def set_mouse_pos6 @3 A7 ?1 O# c" P& A
  942.     if viewport.nil # necessary!5 F% j/ F5 s5 y! B/ @
  943.       vp_x, vp_y = 0, 0
    5 p1 V" n' h& }! P
  944.     else
    * A4 D9 F; ~- }
  945.       vp_x = viewport.rect.x - viewport.ox; ]* z$ O. H- j: O7 P# U
  946.       vp_y = viewport.rect.y - viewport.oy& C9 K+ d' p5 S3 n- C# K# E+ P
  947.     end6 |/ Z" x% M$ {: j$ d6 d/ A
  948.     item_x1 = vp_x + x + standard_padding 4 x/ q% `" s% [  M+ ^" Q& C% a
  949.     item_y1 = vp_y + y + standard_padding
    4 M7 x* t, }5 x1 p8 O
  950.     get_index = @index  0  0  @index + R" a  @. I) ~: Z% D! c7 D
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)- p, Y# F( @, }4 r+ U0 W
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    ( y2 M1 z* \* W3 n4 O
  953.     Mouse.set_mouse_pos(new_x, new_y)5 F4 c* |, f1 B1 t2 `. \
  954.   end
    ! b+ K' }0 o- m; Q
  955. end
    " w2 ]) v, G1 X. M9 s
  956.   D  i" N% _, F7 W- \" Y
  957. #==============================================================================
    0 H. r9 H& t; o5 w- H
  958. # ■ Window_Message$ z9 q! w4 i$ E6 s4 C4 ]% J$ T' r
  959. #------------------------------------------------------------------------------
    1 W' z1 F. F4 E  P1 X/ L* [; u
  960. #  显示文字信息的窗口。& J* L( R$ e2 Q5 F/ e# H6 A% d
  961. #==============================================================================
    ( L9 j, R! G9 y+ \! @& C% f+ X" R4 R" I- U
  962. class Window_Message  Window_Base( q* b! Q7 g# g, j# l
  963.   #--------------------------------------------------------------------------  \& ?6 v& C; }% {2 G% G
  964.   # ● 处理数值的输入(覆盖原方法)& m" W0 Z$ s; T" D! @9 t
  965.   #--------------------------------------------------------------------------
      x" {- ]: e8 D
  966.   def input_number/ t! f6 p9 \! L3 T$ S& H; n
  967.     @number_window.start- `2 z. U3 C7 ~0 [) D
  968.     Fiber.yield while @number_window.extra_window.active
    6 x( u- r; y. m7 U# ^8 F
  969.   end
    + }! q3 D0 ?( d1 o5 `  ?5 z; s0 e
  970. end" ~6 t$ l" _0 ~0 W0 h0 a! {
  971. 4 d- R' X2 Y9 y( e1 L. \5 T" o
  972. #==============================================================================
    & j6 D# v2 J1 S5 R' |3 W) m( h
  973. # ■ Window_PartyCommand  l( H& I4 G4 |- S0 k: T0 q. M; P
  974. #------------------------------------------------------------------------------
    % C+ q4 L: Y) ^% `1 \( g2 j0 o+ U
  975. #  战斗画面中,选择“战斗/撤退”的窗口。3 _6 l% }# d$ x3 ]/ G1 y9 H
  976. #==============================================================================
    " K* a* l# {  U0 E3 x
  977. class Window_PartyCommand  Window_Command
    ; P8 N" q- D5 w' S# I4 I! X
  978.   #--------------------------------------------------------------------------$ W0 r. K6 u8 Q+ r0 w
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置0 E- L' F7 E) m4 t! w$ F3 r7 J% p
  980.   #--------------------------------------------------------------------------
    , j5 t7 l# E0 ~, n% \0 [# b
  981.   def set_mouse_pos
    ; G0 P2 L* ^* j- o4 ~
  982.     if viewport.nil
    % ~+ @9 ?0 h; {- I: U1 l8 c
  983.       vp_x, vp_y = 0, 0- V: j6 O6 ]  \: Y% {1 t/ M3 N
  984.     else
    5 b% B# a# k. Q' s
  985.       #vp_x = viewport.rect.x - viewport.ox: k& @) m  Y6 ~1 ?. I4 Q) F
  986.       vp_y = viewport.rect.y - viewport.oy
    1 w. k1 R& w: |% P
  987.     end, a5 v% {1 l2 R% j% P
  988.     item_x1 = x + standard_padding
    ; L2 c, P2 \2 w! f3 t; C2 Y8 R
  989.     item_y1 = vp_y + y + standard_padding
    $ j; W* w! U. Q1 L( N% d* D
  990.     get_index = @index  0  0  @index
    ! J7 ^& I# s7 f- |4 Z# j
  991.     row = get_index  col_max - top_row" X6 |8 i& r& I. F1 t
  992.     col = get_index % col_max; \7 R# _4 h0 H8 V
  993.     new_x = item_x1 + item_width  (col + 0.5)
    ( n+ i  S  ]* d# `' ~  g4 [& E
  994.     new_y = item_y1 + item_height  (row + 0.5). k+ S; ^% X$ O
  995.     Mouse.set_mouse_pos(new_x, new_y). a1 U0 {' a! }2 f( }" w
  996.   end' S+ g2 t& h+ i: X' |
  997. end
    & n0 a5 k* E; |$ m/ Z$ z  Y% H

  998. $ Q3 h& q5 D  H8 S
  999. #==============================================================================
    / q1 G$ W* W: `# u
  1000. # ■ Window_ActorCommand
    # C2 h5 n4 o8 b
  1001. #------------------------------------------------------------------------------0 ~0 B2 M. R0 J( G3 d
  1002. #  战斗画面中,选择角色行动的窗口。- K9 s0 t' w. F0 `4 r
  1003. #==============================================================================9 U) A8 [3 t, v' h
  1004. class Window_ActorCommand  Window_Command
    - |6 Z. h1 q$ R2 N6 M
  1005.   #--------------------------------------------------------------------------
    4 t" Q- g% u( n7 }6 {# t
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ J8 g3 A8 f" p7 _- {! D
  1007.   #--------------------------------------------------------------------------2 @+ s0 t  d8 K: C# H1 n
  1008.   def set_mouse_pos
    + R- M0 G8 F7 G! H& x/ u/ {
  1009.     if viewport.nil; d8 n' g+ s% S
  1010.       vp_x, vp_y = 0, 0
    $ P5 `& |2 J( ^" Z- O- j
  1011.     else
      t& l! m+ b; `' k- m6 w' k
  1012.       #vp_x = viewport.rect.x - viewport.ox1 q/ P, y. [# E
  1013.       vp_y = viewport.rect.y - viewport.oy+ q; s3 W9 W2 B' r7 Z6 y
  1014.     end4 U/ i6 \, D* A4 z" O2 H
  1015.     item_x1 = Graphics.width - width + standard_padding
    % d6 h. f6 A$ ?5 X# o2 }( E
  1016.     item_y1 = vp_y + y + standard_padding
    : m5 i% c0 Q+ _
  1017.     get_index = @index  0  0  @index
    5 m& A/ h/ ^/ Q9 R7 v( C# A$ K/ t) {
  1018.     row = get_index  col_max - top_row
      Z7 p+ \  `5 B* V: v+ ?
  1019.     col = get_index % col_max
    5 L/ s- |$ v6 Z2 L0 ~9 ?/ K9 y! u
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    & L" L5 B) J- x+ A3 r
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    . E( K  C) k% `4 ?
  1022.     Mouse.set_mouse_pos(new_x, new_y)
    0 g0 [# y( Q& _9 i0 n' b* O
  1023.   end
    # W1 ^, y& n& c% O, I2 f
  1024. end
    ' v- u4 y+ Z# a& I6 X% ?5 l

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

  2145. . y( O( Z, I* _& |6 I
  2146. #==============================================================================) g' `9 B) J: @9 u8 O" `- |
  2147. # ■ Game_Map
    + N4 w2 U  k& `1 D* F% y, `! Q4 p8 @1 P
  2148. #------------------------------------------------------------------------------
      E8 x: ^$ v. X$ K
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。/ V, i9 g5 b8 b5 M, j1 l4 |& k
  2150. #   本类的实例请参考 $game_map 。
    ; O$ u4 b! g* x7 X7 e( Y' q9 G
  2151. #==============================================================================
    ' I9 E& \; q  ^6 k
  2152. class Game_Map3 b) R  _, a# Y$ A6 l8 x( L
  2153.   #--------------------------------------------------------------------------9 M# H* A! E3 _9 P' t7 m7 S/ [
  2154.   # ● 定义实例变量& c( [, N" Z2 Q- ~$ X' Y0 x! h
  2155.   #--------------------------------------------------------------------------9 {9 ~/ R9 [* {1 E
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据8 W) }7 }( O) Q% d6 P+ B! F' l! F9 d
  2157.   attr_reader mouse_map_y # 同上
    0 {4 k+ m5 t) p" J4 r/ D
  2158.   #--------------------------------------------------------------------------1 _8 f) s2 x0 L6 h( V
  2159.   # ● 初始化对象
    - K  K. I0 c  T0 p' m
  2160.   #--------------------------------------------------------------------------
    4 Q2 E/ z+ _2 T4 w+ e. Q$ w% Q
  2161.   alias sion_mouse_initialize initialize, W4 g  \& e4 p% o6 ~
  2162.   def initialize
    : {. E4 L/ g' W' S% o0 s" [
  2163.     sion_mouse_initialize, u) s7 d& E/ a6 @
  2164.     creat_move_sign  ###
    6 y* L4 j' {" v
  2165.     set_constants
    4 f8 D7 i( s9 }, `# @  L- L5 }
  2166.   end4 q7 Q) B( C" G
  2167.   #--------------------------------------------------------------------------
    # }) Z$ Z2 g+ @! r1 _% U
  2168.   # ● 更新画面1 h$ [" K# G4 t6 m- x/ ]' P
  2169.   #     main  事件解释器更新的标志/ r1 }+ l& o3 U% t' P. M* m8 y
  2170.   #--------------------------------------------------------------------------$ K6 }+ R0 d/ b
  2171.   alias sion_mouse_update update6 G2 ?# U- q! Z3 P
  2172.   def update(main = false)
    : e# ?7 v& f& ?4 g2 F9 }
  2173.     sion_mouse_update(main): T2 ?2 k4 x6 M: ]* Y
  2174.     update_move_sign
    " U) y+ {7 U' L9 n/ {' {3 C
  2175.   end% J0 B* }: x7 v. |0 e3 n6 `
  2176.   #--------------------------------------------------------------------------* z" ~; Z4 l6 Z- a& L  k
  2177.   # ● 创建显示路径点的事件% B% e3 C, w  u7 ~& n, a& R' r) c
  2178.   #--------------------------------------------------------------------------
    4 \2 z6 S5 B4 l( I, f, o8 d) z2 a
  2179.   def creat_move_sign
    3 w- v2 H0 T$ O% G. O
  2180.     $mouse_move_sign = Move_Sign.new
    $ z" x. X! D7 Y0 G& X7 ~
  2181.   end4 s# c6 ?/ d4 M' _* H
  2182.   #--------------------------------------------------------------------------
    * y8 p: {" Y8 M/ }# u$ N- [
  2183.   # ● 更新显示路径点的事件% H8 B/ w  c3 O5 S& V( S
  2184.   #--------------------------------------------------------------------------
    5 A3 d/ R# x  [( B8 [
  2185.   def set_constants
    7 T+ ?% U; X: \, V2 U; U  k
  2186.     @mouse_pos_setted = true+ a0 F' h% O1 {2 @  P! t
  2187.     @set_pos_prepared = false2 k  W7 s0 s0 D& @  V
  2188.     @mouse_old_x = 08 H# o. p" C. u4 C6 `4 w: B
  2189.     @mouse_old_y = 0: I( P/ o# t. j- O
  2190.   end9 o5 d9 i6 ~: g) Q6 y
  2191.   #--------------------------------------------------------------------------8 @5 h0 }7 D# \; N" l
  2192.   # ● 更新显示路径点的事件
    ; V2 H0 t: B, \- X" ?& \. l8 J
  2193.   #--------------------------------------------------------------------------
    3 B2 R4 u; l9 y: T# v
  2194.   def update_move_sign- u' h* ?  L. X* B; Z0 q1 d
  2195.     $mouse_move_sign.update) Q* M) Q9 H8 H
  2196.   end
    2 |, u8 S7 {4 Y2 T( V
  2197.   #--------------------------------------------------------------------------
    # w: k5 _# m2 A/ c5 \
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    $ w  e/ [1 i* S% l# o
  2199.   #--------------------------------------------------------------------------
    9 J; V" J& W. p% a7 N; b
  2200.   def get_mouse_map_xy, U8 |% i1 g3 e( P" L* l' {6 G
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y( e" F% v  K7 Q2 x
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    ) V2 }$ h/ g/ f
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)  s8 [3 E0 Y! F; Q+ S& l
  2204.   end
    : g& _9 n0 G) Q8 N4 D
  2205.   #--------------------------------------------------------------------------
      Z3 l/ L" x* O" J0 ^5 b
  2206.   # ● 返回地图画面时重设鼠标坐标
    9 p9 N+ B9 n1 M  J% E$ C) F3 |$ B
  2207.   #--------------------------------------------------------------------------  p. a1 q$ a: p) f7 r, G
  2208.   def reset_mouse_pos6 W4 ]- q9 X# x5 |# I2 Y& N
  2209.     return if @mouse_pos_setted
    . X7 @" q; E: I7 v9 n& ~8 K+ e# G6 n
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    " X1 N8 j4 ~$ V  O8 G" \8 q; t
  2211.     @mouse_pos_setted = true
    : V; i5 ?! v, a2 T# T/ @
  2212.     @set_pos_prepared = false* z8 r& W- t0 Q$ v9 ^6 @4 Y
  2213.   end
    . Q# H9 f: \/ q) T1 i2 d
  2214.   #--------------------------------------------------------------------------
    % r7 g. q3 m. D- f) {! [. J
  2215.   # ● 重设鼠标的坐标  ^/ s# }+ g9 {, P  S$ A
  2216.   #--------------------------------------------------------------------------, H1 H5 H& Q/ o7 E4 t0 ~- r
  2217.   def prepare_reset_mouse_pos
    ; c9 [$ d4 v% d9 L% p
  2218.     return if @set_pos_prepared
    $ L% I$ ?9 _) [- I
  2219.     @mouse_pos_setted = false
    1 ^4 [; s4 x6 M. n; \+ m
  2220.     @mouse_old_x = Mouse.mouse_x! y& F( ?1 o# S
  2221.     @mouse_old_y = Mouse.mouse_y
    7 [% D1 {# n3 x  |
  2222.     @set_pos_prepared = true' z6 l/ L8 C8 ]) B, T: O4 Z$ U/ W4 u# p
  2223.   end
    . [# {( S/ _- ]2 m: Q' V
  2224. end
    8 H* _5 B# g; b6 ?" u3 o, Z9 Z% Z2 Z

  2225. ! ~$ `8 V9 @4 x' Z$ K4 l
  2226. #==============================================================================
    0 h, m; M* c" _/ R$ A
  2227. # ■ Spriteset_Map
    : w9 t8 g" l  e; g3 Y- d
  2228. #------------------------------------------------------------------------------
    : W8 A  R0 B; B) p8 g- f
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    & L& r9 c! ~7 L( t' S) n: s) Q
  2230. #==============================================================================
    * F! S9 Y+ @5 K7 {
  2231. class Spriteset_Map9 [/ P. f. [, a7 Z2 `5 c
  2232.   #--------------------------------------------------------------------------
    9 c5 B7 F2 @- m# c
  2233.   # ● 生成路径点精灵- f7 ~, ^3 k2 E  V
  2234.   #--------------------------------------------------------------------------: q6 P9 |' m# }1 X& J0 B2 s1 G
  2235.   alias sion_mouse_create_characters create_characters
    ( b6 m( E3 \! c# O8 e5 W! c
  2236.   def create_characters
    4 M  k0 |+ e% _! o
  2237.     sion_mouse_create_characters! |/ |9 l( q- V+ r
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))2 ?8 Q6 e8 ]! ]- w! L: }3 p% i
  2239.   end& h* e" U9 R, G% v" A
  2240. end; `0 Q5 M$ l3 J: E8 \9 f
  2241. " Q! o* `1 y0 r4 w, ~' f$ T/ J
  2242. #==============================================================================7 a( d$ k% k3 f5 m* [2 c
  2243. # ■ Scene_Map
    9 E5 g( z' w! G6 r1 t
  2244. #------------------------------------------------------------------------------- M6 |& E: D8 w" d; b
  2245. #  地图画面
      a2 G, |5 P& L' T4 c
  2246. #==============================================================================7 i; a$ j. i) o" G. U
  2247. class Scene_Map  Scene_Base; ?  \+ S0 p! Q6 t) j' n1 ~
  2248.   #--------------------------------------------------------------------------
    ) l6 F( \8 B7 B( Z0 U+ m0 A
  2249.   # ● 画面更新
    : q( U4 c. q  X) e
  2250.   #--------------------------------------------------------------------------5 Y* M  }! ^" r! v
  2251.   alias sion_mouse_update_scene update_scene
    , x) J+ ~, Z6 [- ]% O( v6 g0 w. b8 u
  2252.   def update_scene
    3 N' {1 h5 ~0 I
  2253.     sion_mouse_update_scene
    ! z9 {$ n: T' Y* M0 `. j" S: i, ]( C
  2254.     update_mouse_action unless scene_changing
    . j, t4 X" j, w
  2255.   end3 Y1 M% i' B& C- s# s" ^7 p
  2256.   #--------------------------------------------------------------------------
    3 C: D8 j5 z. h* w+ p
  2257.   # ● 场所移动前的处理
    ' j- b  ]% A* Y6 |3 ?# @7 O
  2258.   #--------------------------------------------------------------------------; q# O2 D  Y2 \& I6 m
  2259.   alias sion_mouse_pre_transfer pre_transfer, i8 r3 y2 P: V, C3 ?: ~" e
  2260.   def pre_transfer
    5 \$ n0 _8 Y, e% x! x
  2261.     $game_player.reset_move_path8 A" D. e# B7 ^$ S1 a* ?* z
  2262.     sion_mouse_pre_transfer# [: q1 N) o/ E0 Q
  2263.   end  q: p) O9 e1 H2 g/ _! J$ K
  2264.   #--------------------------------------------------------------------------
    2 I& ?. `% K) M5 s6 {3 {6 r
  2265.   # ● 监听鼠标左键的按下/ H. C. b: i0 J# x
  2266.   #--------------------------------------------------------------------------6 h2 E7 p; r+ f5 n
  2267.   def update_mouse_action- V4 u9 I* K/ ?. z$ R& }0 _8 o  K
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    ) w* g3 I1 {7 C
  2269.   end# C8 m! E4 B& V- b) ~, I" C  L" |
  2270. end- c) d, O+ i& q2 v8 j4 R4 }8 {- ?

  2271. 6 G1 D: t- p# H! e$ E
  2272. #==============================================================================* a- y6 r+ s5 L5 G  G2 x. _
  2273. # ■ Scene_File
    : Y2 ]9 a6 d9 K4 {. M
  2274. #------------------------------------------------------------------------------; X# q# d- P5 A" f& f! L) ]
  2275. #  存档画面和读档画面共同的父类  f8 Y8 f( t5 }' Z: Q% P1 i, ?
  2276. #==============================================================================
    * v/ y0 G' Q2 G- g
  2277. class Scene_File  Scene_MenuBase$ j' q, D9 d/ Z# W; J6 X8 o/ v+ f
  2278.   #--------------------------------------------------------------------------8 N- h& j% \* F7 [  V! w8 H
  2279.   # ● 开始处理
    # T* I/ R: z8 ?- H# k
  2280.   #--------------------------------------------------------------------------
    * ]) J2 ^6 ^5 t" t6 ^4 N* f  z( Z
  2281.   alias sion_mouse_start start
    . Y+ o9 U/ u/ F  a
  2282.   def start
    8 b4 B8 ~! m" R7 o' o2 }
  2283.     sion_mouse_start
    & L6 \+ I& J+ k+ z, p- s0 k+ D
  2284.     @move_state = 0  ?$ m7 l7 g6 b- ^# G
  2285.     set_mouse_pos, c& ?5 P2 ?/ T) Y/ _0 l) z
  2286.   end: c6 C4 `& g+ {
  2287.   #--------------------------------------------------------------------------
    ; z. h; u4 P0 k/ O+ G6 L0 [
  2288.   # ● 更新画面$ n, l8 a& x+ k' S% t4 V
  2289.   #--------------------------------------------------------------------------
    & C+ V; O' N% a5 t; X) t
  2290.   alias sion_mouse_update update
    2 t- [& H6 ~# h9 e# v
  2291.   def update
    1 t% K3 [$ I3 m! X9 u" r, ^0 b
  2292.     sion_mouse_update
    & ^& f3 S4 ~- T  W. ]5 d
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos( S; b# _+ h& a$ A% l9 E& v  l
  2294.   end
    $ e+ c2 F; H% I+ V0 n4 G2 _
  2295.   #--------------------------------------------------------------------------
    # B& ^9 Z/ a6 I) u) g& b4 I
  2296.   # ● 更新光标
    - G% c& I* y) R9 g
  2297.   #--------------------------------------------------------------------------( Y3 B* n/ {& Q- E% G
  2298.   def set_cursor
    8 o/ i( P, M( N# d
  2299.     @move_state += 1
    5 T5 n5 d7 Q" [  M* w  c+ P4 |
  2300.     last_index = @index
    : e! |% R9 h9 l6 d& R& J
  2301.     if mouse_which_window == -2/ P+ }- z7 {% f# d2 z
  2302.       if (@move_state - 1) % 6 == 0
      W4 y8 y8 Q1 X# d
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    6 ?% M4 _4 ~  Y' d9 l" h( N
  2304.       end8 ^' A, N+ l1 q! q
  2305.     elsif mouse_which_window == -15 m" h6 o0 j2 s1 `
  2306.       if (@move_state - 1) % 6 == 0. I% X5 }8 @* J2 K; X5 ~- ^6 _; P
  2307.         @index = (@index - 1 + item_max) % item_max if @index  05 f* l# G7 i) N/ d" K0 `! l2 ]! Q, o& I
  2308.       end, u! k& S* J) U) J. d7 ]
  2309.     else% I( H" ~/ `3 ^+ {/ j
  2310.       @move_state = 0& E6 J* I1 y! m
  2311.       @index = top_index + mouse_which_window+ u3 r- q& R3 \; y  Q/ b  d
  2312.     end
    1 p! _- T' Q* C1 m& r- y0 v3 N
  2313.     ensure_cursor_visible, o: P8 K: y9 r! W$ G2 T: V
  2314.     if @index != last_index
    ; ?( X5 H# B' s, f! a) r
  2315.       @savefile_windows[last_index].selected = false
    : W7 q: q: J: s* V, r: b2 E: s
  2316.       @savefile_windows[@index].selected = true
    ' `4 e0 }, e5 h
  2317.     end+ n, G' R# e* ~8 g3 ^) D
  2318.   end
    1 j8 |% g3 {& W; ~! I- C+ {' ?
  2319.   #--------------------------------------------------------------------------/ {  a0 k2 [4 [4 ~  g
  2320.   # ● 判断鼠标位于哪个窗口
    8 @; G7 Z) ^' ]$ O: l! J
  2321.   #--------------------------------------------------------------------------1 X( i* E1 x- Z7 }
  2322.   def mouse_which_window
    & q. z) a5 N1 C7 B5 l
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y" J9 B1 [) H0 w0 {% \1 ~
  2324.     if mouse_y  @help_window.height + 14  Y, f" Y  V; \) X! A
  2325.       mouse_row = -1
    4 [: h; j; [' f4 W' u+ M1 a
  2326.     elsif mouse_y  Graphics.height - 143 r5 V- r+ z# v4 h# C: M
  2327.       mouse_row = -28 ^. |7 M. \. _7 n4 F
  2328.     else* u$ x$ w4 Y, X! d9 O& \. A$ H
  2329.       mouse_row = 4  (mouse_y - @help_window.height) 5 D1 L0 |( s1 h: _
  2330.         (Graphics.height - @help_window.height)
    * `9 W% E  F! [; S4 B* i
  2331.     end
    . J, W) {) o# D  Z+ E
  2332.     return mouse_row
    ) s0 z/ h! E& x3 z5 M  @
  2333.   end
    0 m1 ~! X& A- |2 A7 S4 \
  2334.   #--------------------------------------------------------------------------
    * d& B9 x7 ?' d
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    - _+ ?& N0 c; h- a+ G
  2336.   #--------------------------------------------------------------------------6 w) ]5 L2 ?$ `. N9 L
  2337.   def set_mouse_pos8 [+ N! _" C  d8 \% d$ e- u8 k
  2338.     new_x = 40' @, a: S7 `  c7 M5 F
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    - b% h2 a% c4 t! }0 g
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    4 t6 i: _& a' E( m6 p( h4 C
  2341.   end$ k, }8 f' u5 d% R9 b
  2342. end
    ; k# s) g+ c" P5 C

  2343. ( E, w: v- r- \) r$ n+ \
  2344. #==============================================================================
    % S( W, J5 c" O5 R( N
  2345. # ■ Game_Event
    5 _/ t& N3 e+ F6 f
  2346. #------------------------------------------------------------------------------& Y' |7 f/ g) o$ A  I
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。5 y, N! A9 R/ B) o' e2 m
  2348. #   在 Game_Map 类的内部使用。. A) @- ^+ y5 Z* b3 @
  2349. #==============================================================================
    * p# C. r7 D% j
  2350. class Game_Event  Game_Character$ l& s% l% R  ~, U3 j
  2351.   #--------------------------------------------------------------------------9 Y( `3 f0 D: O
  2352.   # ● 事件启动8 @+ U- ]% l: Q; ?
  2353.   #--------------------------------------------------------------------------" [; L4 s4 m. A5 F
  2354.   alias sion_mouse_start start7 e1 c% W. s$ V( H% B" G
  2355.   def start! c8 v+ }; \+ ]$ Y' O" G
  2356.     return if mouse_start && !Mouse.press(0x01)
    ! T8 J) C' a5 b* Z
  2357.     sion_mouse_start
    % w: {. `( f9 e8 z! J
  2358.   end
    ! @+ u2 C- p+ Y6 |; J7 d
  2359.   #--------------------------------------------------------------------------
    $ J* E; g6 h/ v
  2360.   # ● 判断事件是否由鼠标启动
    , k2 D4 v4 O4 e  S6 I
  2361.   #--------------------------------------------------------------------------+ A. n  x) K5 I
  2362.   def mouse_start
    7 h/ b2 P6 D, g7 U6 r7 Y
  2363.     return false if empty
    5 a8 O# E" l0 @4 F6 ?
  2364.     @list.each do index
    * t1 u) I; t; F& A0 M' X6 J
  2365.       return true if (index.code == 108  index.code == 408) &&
    ) B: w9 p% K) x1 m
  2366.         index.parameters[0].include('鼠标启动')
    + ~% U3 s" o6 _6 c9 o& w. l
  2367.     end
    2 Y2 g2 k0 Q% G+ \# s
  2368.     return false
    ! ?2 O% T( T, E0 ~9 I
  2369.   end8 `8 q8 a' Q' Q* d: w
  2370. end
    9 H% G* C' y! O5 w3 R( p" \
  2371. - o4 k1 O# h8 v3 q! l% O
  2372. ####泥煤的height: i9 I" G# ^, p' k6 a
  2373. # @height = height" `* w  X$ T: \; V

  2374. : X6 w% k- l% g* B# O- S
  2375. class Area_Response* V4 _" S4 R. z2 d$ E, x  q7 f
  2376.   attr_accessor type( p* }0 _' w- H  w; W
  2377.   attr_reader ox
    7 r; e% e+ l# \
  2378.   attr_reader oy
    1 j. s6 J; q& g# b! y, S
  2379.   attr_reader width5 ]8 C7 H6 R2 _$ u1 i
  2380.   attr_reader height
    " @8 h2 q; x/ O* s( \+ H% k) {
  2381.   attr_reader switch_id
      r$ y6 J8 e" w
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    8 Q, _1 b7 j* N( ^
  2383.     @type = type
    # r0 [8 {/ O0 E, c, m5 X
  2384.     @ox = ox( F$ u- i% |: s7 C& t
  2385.     @oy = oy1 y4 w5 z) \! [; X# E- D: I
  2386.     @width = width0 b5 F  C8 A" ~
  2387.     @height = height
    9 i. o: _" J$ G/ w
  2388.     @switch_id = switch_id; \# r/ P! q; E
  2389.   end: S% h3 ?4 l. ^! H+ ?5 I9 D
  2390. end% d5 ?2 B5 M. `6 V: A8 Y! Y
  2391. ! V" [1 ^' Y2 H9 X. m7 x0 E
  2392. $area_responses = []
    ) W4 @, i5 M0 ~" M& ^( l* t

  2393. 5 x9 @. {. z$ X5 I: I- G
  2394. class Scene_Map3 ^8 f: V9 v) T" O' m6 k9 A2 E
  2395.   alias update_mouse_2013421 update_mouse_action
    ; p' m: W5 N9 J7 p8 Q
  2396.   def update_mouse_action* R" f- w7 ^; l; z, F& r" l6 b
  2397.     update_area_response
    , e: O, U* j: C" j" U
  2398.     update_mouse_2013421) L1 ~* h% ^/ M$ v$ F( L8 h
  2399.   end+ w/ u' p7 Q' {) T
  2400.   def update_area_response
    ( a) z& ?! A0 T: a
  2401.     responses = $area_responses
    3 U( z: X- l9 Z4 d/ q/ a( n
  2402.     responses.each {response
    : c: \; J* [2 @" O$ c4 H/ q
  2403.       ox = response.ox
    * |) G& N/ h( _; |3 e  P# N4 ^
  2404.       oy = response.oy
    7 a- k  O, Q& w8 [
  2405.       width = response.width
    , ?3 F" H; R/ ]- Y+ z
  2406.       height = response.height; Q7 n+ H7 U" @; J
  2407.       switch_id = response.switch_id$ x/ C: _- C2 o8 s
  2408.       case response.type3 O) f! l# E7 A3 w* Y& l7 k
  2409.       when 0- f( y! R! v' u& X4 E& A
  2410.         if mouse_in_area(ox, oy, width, height)
    3 w1 E# e+ O3 [, M7 u" u* `
  2411.           $game_switches[switch_id] = true
    ! F8 i  E6 n4 y; b% M2 i
  2412.           $area_responses.delete(response)
    $ \: L( d5 o# b
  2413.         end
    ; T( v' |: A$ G  W: H! Z1 W
  2414.       when 1
    3 l2 P& G2 P% o0 A
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    # V, ~0 u( T+ B" ^6 W8 W5 \
  2416.           $game_switches[switch_id] = true
    / K# D6 Q& Q7 b  ~/ C( n. m
  2417.           $area_responses.delete(response)( ^2 G& @# H- Z9 C( ?' P% l+ H
  2418.         end
    * y# G! H! h( \: e+ G
  2419.       when 2
    " G" W! g& Y; t/ X
  2420.         if mouse_in_area(ox, oy, width, height)
    ; d- x- K8 G% ~# W& `9 s
  2421.           $game_switches[switch_id] = true& x2 q8 m) g8 x1 R. p
  2422.         else8 }0 v3 k: M4 @" N- f% b; Z, v
  2423.           $game_switches[switch_id] = false: X/ }% r% w4 N6 u; i/ n# L- s
  2424.         end
    $ T, `- i0 A- B# l% ?( r6 ]: c
  2425.       when 3) q+ @) W; A, T6 u1 M) S8 B) o
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,, l" k& u. z/ i
  2427.             (oy - $game_map.display_y)  32, width, height)
    1 O" ?1 c9 X# |1 G
  2428.           $game_map.events_xy(ox, oy).each {event: Z& r; F! `4 I+ B8 K" A
  2429.           event.start( O+ ?& p! B6 O7 Z, c& Q1 [
  2430.           $area_responses.delete(response)
    1 [! f0 @' ~: l  K, a! v
  2431.           return) S: [3 ^: X) X
  2432.           } & E) O9 o! L1 E( B& U1 ^& V. A0 a6 i
  2433.         end/ Q) R- H, I+ P- i5 v
  2434.       when 4
    : N6 M# A) F0 S
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    7 N  w$ [7 O% R; k8 P
  2436.             (oy - $game_map.display_y)  32, width, height)) F, e' }, x1 D6 }& h9 K
  2437.           $game_map.events_xy(ox, oy).each {event
    * q9 L7 s% o* J4 X
  2438.             event.start
    / l! h% F7 C; A! D8 |
  2439.             return
    & b2 `" o# \. R# Q" W3 V4 b
  2440.           }
    7 }- @) `& b2 l8 A6 D
  2441.         end6 o) a4 {' ~+ Y# S! q6 I! D
  2442.       end
    0 K1 C) C9 }0 s( H+ e) E% T0 p; B
  2443.     }  q) x$ \% z$ }) [) G4 c
  2444.   end# K! _! k" _& }7 b6 Y- R
  2445.   def mouse_in_area(ox, oy, width, height)
    8 y8 n: X3 H0 N* q7 I- v
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    + P3 `; D* N, \7 G- y- f7 O
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    # J5 |& Y2 s1 ?  [6 k/ A8 f
  2448.   end' L, W) ^. C6 D( M5 ~8 O2 s
  2449. end; K7 |9 c) A, L( M  d  Y( N
  2450. class Game_Interpreter
    9 y/ j  {% j/ _% ?7 w+ W0 x, D
  2451.   def area_response(arg)3 W- [, \, t- E& R2 `1 s
  2452.     $area_responses.push(Area_Response.new(arg))- }! X: B: i5 ?1 E$ o1 [
  2453.   end
    , M( p0 M7 v7 K
  2454. end
    / O) Z8 ~8 z, H: |( _- ~
复制代码

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

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

GMT+8, 2025-2-19 07:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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