Project1
标题: 【1VIP】鼠标选择目标出问题 [打印本页]
作者: 李梦遥    时间: 2011-9-3 22:25
标题: 【1VIP】鼠标选择目标出问题
 本帖最后由 李梦遥 于 2011-9-4 20:40 编辑 
我用的是超级战斗,使用的4帧战斗图,而且用了鼠标系统,可能是因为战斗图太长,导致鼠标选择敌我双方的选项位置有问题,明显的X坐标偏右边了,希望有人能够帮我把战斗部分的选定敌人我方的坐标改一下。
向左边调一下~~~
已经传上工程,内含战斗脚本和鼠标脚本,望解决~~~~
鼠标脚本如下:- $game_rect = Rect.new(370,450,650,170)#(x,y,width,height)
 
 
- #x是矩形坐上角x坐标,y就是其y坐标,
 
- #width是矩形宽.height是矩形高,在这个范围内的鼠标点击将被和谐掉
 
 
- class Game_Event
 
-   attr_accessor :flag
 
- end
 
 
- #==============================================================================
 
- # ■ Game_Map
 
- #------------------------------------------------------------------------------
 
- #  处理地图的类。包含卷动以及可以通行的判断功能。
 
- # 本类的实例请参考 $game_map 。
 
- #==============================================================================
 
 
- class Game_Map
 
-   #--------------------------------------------------------------------------
 
-   # ● 检查鼠标处是否有自定义的事件并返回类型
 
-   #--------------------------------------------------------------------------
 
-   def check_event_custom(mouse_x, mouse_y) 
 
-     for event in $game_map.events.values #循环所有事件检查
 
-       event_width = RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数
 
-       event_height = RPG::Cache.character(event.character_name,event.character_hue).height / 8
 
-       if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
 
-         if event.list != nil
 
-         for i in 0...event.list.size
 
-           if event.list[i].parameters[0] == "Item"  #类型判断
 
-             event.flag = 1
 
-           elsif event.list[i].parameters[0] == "Npc" #类型判断
 
-             event.flag = 2
 
-           else
 
-             event.flag = 0 if $game_player.get_mouse_sta != 2 #无标志
 
-           end
 
-           return event.flag #返回事件类型标志
 
-         end
 
-         end
 
-       end
 
-     end
 
-     return 0 if $game_player.get_mouse_sta != 2 #如果不是在跟随鼠标状态,则返回无标志
 
-     return $mouse_icon_id #使鼠标图不变化
 
-   end
 
-   #--------------------------------------------------------------------------
 
-   # ● 检查鼠标处是否有事件可以开启
 
-   #--------------------------------------------------------------------------
 
-   def check_event_custom_start(mouse_x, mouse_y) 
 
-     for event in $game_map.events.values #循环所有事件检查
 
-       #事件角色图片宽度、高度
 
-       event_width = RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数
 
-       event_height = RPG::Cache.character(event.character_name,event.character_hue).height / 8
 
-       #判断是否鼠标在事件上
 
-       if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
 
-         way_x = $game_player.x - event.x
 
-         way_y = $game_player.y - event.y
 
-         if [1,0,-1].include?($game_player.x-event.x) and [1,0,-1].include?($game_player.y-event.y)
 
-           for i in 0...event.list.size
 
-             if ["Item","Npc"].include?(event.list[i].parameters[0]) #当事件属于自定义事件
 
-               #判断主角朝向
 
-               if way_x == -1
 
-                 p_direction = 3 if way_y == -1
 
-                 p_direction = 6 if way_y == 0
 
-                 p_direction = 9 if way_y == 1
 
-               elsif way_x == 0
 
-                 p_direction = 2 if way_y == -1
 
-                 p_direction = 8 if way_y == 1
 
-               else
 
-                 p_direction = 1 if way_y == -1
 
-                 p_direction = 4 if way_y == 0
 
-                 p_direction = 7 if way_y == 1
 
-               end
 
-               event.start #开启事件
 
-               return 1, p_direction #返回即将开启事件以及角色朝向
 
-             end
 
-           end
 
-         end
 
-       end
 
-     end
 
-     return 0, 5 #返回不会开启事件以及角色朝向不变
 
-   end
 
-   #--------------------------------------------------------------------------
 
-   # ● 检查鼠标处是否存在自定义事件 for 寻路
 
-   #--------------------------------------------------------------------------
 
-   def check_event_custom_exist(mouse_x, mouse_y) 
 
-     for event in $game_map.events.values #循环所有事件检查
 
-       #事件角色图片宽度、高度
 
-       event_width = RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数
 
-       event_height = RPG::Cache.character(event.character_name,event.character_hue).height / 8
 
-       if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
 
-         for i in 0...event.list.size
 
-           return 1, event if ["Item", "Npc"].include?(event.list[i].parameters[0]) #返回存在自定义事件以及事件体
 
-         end
 
-       end
 
-     end
 
-     return 0, event #返回不存在自定义事件,以及事件体
 
-   end
 
- end
 
- #=================以下两个用来调整战斗时的手感问题,可以自己试试。
 
- $敌人选框扩大 = 20
 
- $角色选框扩大 = 30
 
 
 
- #==============================================================================
 
- # ● API调用
 
- #==============================================================================
 
- $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
 
- $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
 
- $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
 
- $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
 
- $Window_HWND = $GetActiveWindow.call
 
- $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
 
- module Mouse  
 
-  LEFT = 0x01
 
-  RIGHT = 0x02
 
 
-  def self.init(sprite = nil)
 
-    $ShowCursor.call(0)
 
-    
 
-    @show_cursor = false
 
-    
 
-    @mouse_sprite = Sprite.new
 
-    @mouse_sprite.z = 99999
 
-    @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/001-Weapon01.png')
 
 
-    @left_press = false
 
-    @right_press = false
 
-    @left_trigger = false
 
-    @right_trigger = false
 
-    @left_repeat = false
 
-    @right_repeat = false
 
-    @click_lock = false
 
-    @wait_count = 8#待机动画循环时间
 
-    @mosue_pic = 1#鼠标待机动画编号
 
-    #鼠标点击动画
 
-    @chick_animation = RPG::Sprite.new
 
-    @ani_x = @chick_animation.x
 
-    @ani_y = @chick_animation.y
 
-    #更新
 
-    update
 
-  end
 
-  #------------------------------------------------------------------------------
 
-  # 设置鼠标点击动画
 
-  #------------------------------------------------------------------------------
 
-  def self.animation(animation,x,y)
 
-    @ani_x = x
 
-    @ani_y = y
 
-    x -= $game_map.display_x / 4
 
-    y -= $game_map.display_y / 4
 
-    if animation == nil
 
-      @chick_animation.animation(nil,0)
 
-    else
 
-      @chick_animation.x = x
 
-      @chick_animation.y = y
 
-      @chick_animation.animation(animation,0)
 
-    end
 
-  end
 
-  #------------------------------------------------------------------------------
 
-  # 更新鼠标点击动画
 
-  #------------------------------------------------------------------------------
 
-  def self.update_animation
 
-     if $scene.is_a?(Scene_Map)
 
-       x = @ani_x
 
-       y = @ani_y
 
-       x -= $game_map.display_x / 4
 
-       y -= $game_map.display_y / 4
 
-       @chick_animation.x, @chick_animation.y = x, y
 
-     end
 
-     @chick_animation.update
 
-  end
 
-  def self.exit
 
-    @mouse_sprite.bitmap.dispose
 
-    @mouse_sprite.dispose
 
-    @chick_animation.animation(nil,0)
 
-    @chick_animation.dispose
 
-    @show_cursor = true
 
-    $ShowCursor.call(1)
 
-  end
 
-  def self.mouse_debug
 
-    return @mouse_debug.bitmap
 
-  end
 
 
-  def self.update
 
-    update_animation
 
-    left_down = $GetKeyState.call(0x01)
 
-    right_down = $GetKeyState.call(0x02)
 
-    if Graphics.frame_count * 3 / Graphics.frame_rate != @total_sec
 
-      @total_sec = Graphics.frame_count * 3 / Graphics.frame_rate
 
-      @a = !@a
 
-    end
 
-    if $scene.is_a?(Scene_Map) == false
 
-      $mouse_icon_id = 0
 
-    end
 
-    if $mouse_icon_id != $mouse_icon_id_last
 
-      case $mouse_icon_id
 
-      when 1
 
-        if @a
 
-          @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/GetItem1')
 
-        else
 
-          @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/GetItem2')
 
-        end
 
-      when 2
 
-        if @a
 
-          @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/TalkTo1')
 
-        else
 
-          @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/TalkTo2')
 
-        end
 
-      when 11
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_LOWER_LEFT')
 
-      when 12
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_DOWN')
 
-      when 13
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_LOWER_RIGHT')
 
-      when 14
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_LEFT')
 
-      when 16
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_RIGHT')
 
-      when 17
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_UPPER_LEFT')
 
-      when 18
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_UP')
 
-      when 19
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse_UPPER_RIGHT')
 
-      when 0
 
-        @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/木剑')
 
-      end
 
-      $mouse_icon_id_last = $mouse_icon_id
 
-    end
 
-    if $mouse_icon_id == 0
 
-       if @wait_count <= 0
 
-         @mouse_sprite.bitmap = RPG::Cache.icon("mouse#{@mosue_pic}")
 
-         @mosue_pic += 1
 
-         if @mosue_pic >= 9
 
-           @mosue_pic = 1
 
-         end
 
-         @wait_count = 8
 
-       else
 
-         @wait_count -= 1
 
-       end
 
-    end
 
-    @click_lock = false
 
-    mouse_x, mouse_y = self.get_mouse_pos
 
-    if @mouse_sprite != nil
 
-      @mouse_sprite.x = mouse_x
 
-      @mouse_sprite.y = mouse_y
 
-    end
 
-    if left_down[7] == 1
 
-      @left_repeat = (not @left_repeat)
 
-      @left_trigger = (not @left_press)
 
-      @left_press = true
 
-    else
 
-      @left_press = false
 
-      @left_trigger = false
 
-      @left_repeat = false
 
-    end
 
-    if right_down[7] == 1
 
-      @right_repeat = (not @right_repeat)
 
-      @right_trigger = (not @right_press)
 
-      @right_press = true
 
-    else
 
-      @right_press = false
 
-      @right_trigger = false
 
-      @right_repeat = false
 
-    end
 
-  end
 
-  def self.get_mouse_pos
 
-    point_var = [0, 0].pack('ll')
 
-    if $GetCursorPos.call(point_var) != 0
 
-      if $ScreenToClient.call($Window_HWND, point_var) != 0
 
-        x, y = point_var.unpack('ll')
 
-        if (x < 0) or (x > 10000) then x = 0 end
 
-        if (y < 0) or (y > 10000) then y = 0 end
 
-        if x > 640 then x = 640 end
 
-        if y > 480 then y = 480 end
 
-        return x, y
 
-      else
 
-        return 0, 0
 
-      end
 
-    else
 
-      return 0, 0
 
-    end
 
-  end
 
-  def self.press?(mouse_code)
 
-    if mouse_code == LEFT
 
-      if @click_lock
 
-        return false
 
-      else
 
-        return @left_press
 
-      end
 
-    elsif mouse_code == RIGHT
 
-      return @right_press
 
-    else
 
-      return false
 
-    end
 
-  end
 
-  def self.trigger?(mouse_code)
 
-    if mouse_code == LEFT
 
-      if @click_lock
 
-        return false
 
-      else
 
-        return @left_trigger
 
-      end
 
-    elsif mouse_code == RIGHT
 
-      return @right_trigger
 
-    else
 
-      return false
 
-    end
 
-  end
 
-  def self.repeat?(mouse_code)
 
-    if mouse_code == LEFT
 
-      if @click_lock
 
-        return false
 
-      else
 
-        return @left_repeat
 
-      end
 
-    elsif mouse_code == RIGHT
 
-      return @right_repeat
 
-    else
 
-      return false
 
-    end
 
-  end
 
-  def self.click_lock?
 
-    return @click_lock
 
-  end
 
-  def self.click_lock
 
-    @click_lock = true
 
-  end
 
-  def self.click_unlock
 
-    @click_lock = false
 
-  end
 
- end
 
- module Input
 
-  if @self_update == nil
 
-    @self_update = method('update')
 
-    @self_press = method('press?')
 
-    @self_trigger = method('trigger?')
 
-    @self_repeat = method('repeat?')
 
-  end
 
-  def self.update
 
-    @self_update.call
 
-    Mouse.update
 
-  end
 
-  def self.press?(key_code)
 
-    if @self_press.call(key_code)
 
-      return true
 
-    end
 
-    if key_code == C
 
-      return Mouse.press?(Mouse::LEFT)
 
-    elsif key_code == B
 
-      return Mouse.press?(Mouse::RIGHT)
 
-    else
 
-      return @self_press.call(key_code)
 
-    end
 
-  end
 
-  def self.trigger?(key_code)
 
-    if @self_trigger.call(key_code)
 
-      return true
 
-    end
 
-    if key_code == C
 
-      return Mouse.trigger?(Mouse::LEFT)
 
-    elsif key_code == B
 
-       
 
-      return Mouse.trigger?(Mouse::RIGHT)
 
-    else
 
-      return @self_trigger.call(key_code)
 
-    end
 
-  end
 
-  def self.repeat?(key_code)
 
-    if @self_repeat.call(key_code)
 
-      return true
 
-    end
 
-    if key_code == C
 
-      return Mouse.repeat?(Mouse::LEFT)
 
-    elsif key_code == B
 
-      return Mouse.repeat?(Mouse::RIGHT)
 
-    else
 
-      return @self_repeat.call(key_code)
 
-    end
 
-  end
 
- end
 
- class Window_Selectable
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    self_update
 
-    if self.active and @item_max > 0
 
-      index_var = @index
 
-      tp_index = @index
 
-      mouse_x, mouse_y = Mouse.get_mouse_pos
 
-      mouse_not_in_rect = true
 
-      for i in 0...@item_max
 
-        @index = i
 
-        update_cursor_rect
 
-        top_x = self.cursor_rect.x + self.x + 16
 
-        top_y = self.cursor_rect.y + self.y + 16
 
-        bottom_x = top_x + self.cursor_rect.width
 
-        bottom_y = top_y + self.cursor_rect.height
 
-        if (mouse_x > top_x) and (mouse_y > top_y) and
 
-           (mouse_x < bottom_x) and (mouse_y < bottom_y)
 
-          mouse_not_in_rect = false
 
-          if tp_index != @index
 
-             $game_system.se_stop
 
-            tp_index = @index
 
-            if @index == 0
 
-              if $title == 1
 
-                Audio.se_play("Audio/SE/"+"轮回",100,100)
 
-              else
 
-                $game_system.se_play($data_system.cursor_se)
 
-              end
 
-            elsif @index ==1
 
-              if $title == 1
 
-                Audio.se_play("Audio/SE/"+"拔剑",100,100)
 
-              else
 
-                $game_system.se_play($data_system.cursor_se)
 
-              end
 
-            elsif @index ==2
 
-              if $title == 1
 
-                Audio.se_play("Audio/SE/"+"退出",100,100)
 
-              else
 
-                $game_system.se_play($data_system.cursor_se)
 
-              end
 
-            else
 
-              $game_system.se_play($data_system.cursor_se)
 
-            end
 
-          end
 
-          break
 
-        end
 
-      end
 
-      if mouse_not_in_rect
 
-        @index = index_var
 
-        update_cursor_rect
 
-        Mouse.click_lock
 
-      else
 
-        Mouse.click_unlock                
 
-      end
 
-    end
 
-  end
 
- end
 
- class Window_NameInput
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    self_update
 
-    if self.active
 
-      index_var = @index
 
-      mouse_x, mouse_y = Mouse.get_mouse_pos
 
-      mouse_not_in_rect = true
 
-      for i in (0...CHARACTER_TABLE.size).to_a.push(180)
 
-        @index = i
 
-        update_cursor_rect
 
-        top_x = self.cursor_rect.x + self.x + 16
 
-        top_y = self.cursor_rect.y + self.y + 16
 
-        bottom_x = top_x + self.cursor_rect.width
 
-        bottom_y = top_y + self.cursor_rect.height
 
-        if (mouse_x > top_x) and (mouse_y > top_y) and
 
-           (mouse_x < bottom_x) and (mouse_y < bottom_y)
 
-          mouse_not_in_rect = false
 
-          break
 
-        end
 
-      end
 
-      if mouse_not_in_rect
 
-        @index = index_var
 
-        update_cursor_rect
 
-        Mouse.click_lock
 
-      else
 
-        Mouse.click_unlock
 
-      end
 
-    end
 
-  end 
 
- end
 
- class Window_InputNumber
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    self_update
 
-    mouse_x, mouse_y = Mouse.get_mouse_pos
 
-    if self.active and @digits_max > 0
 
-      index_var = @index
 
-      mouse_not_in_rect = true
 
-      for i in 0...@digits_max
 
-        @index = i
 
-        update_cursor_rect
 
-        top_x = self.cursor_rect.x + self.x + 16
 
-        bottom_x = top_x + self.cursor_rect.width
 
-        if (mouse_x > top_x) and (mouse_x < bottom_x)
 
-          mouse_not_in_rect = false
 
-          break
 
-        end
 
-      end
 
-      if mouse_not_in_rect
 
-        @index = index_var
 
-        update_cursor_rect
 
-        Mouse.click_lock
 
-      else
 
-        Mouse.click_unlock
 
-      end
 
-    end
 
-    if @last_mouse_y == nil
 
-      @last_mouse_y = mouse_y
 
-    end
 
-    check_pos = (@last_mouse_y - mouse_y).abs
 
-    if check_pos > 10
 
-      $game_system.se_play($data_system.cursor_se)
 
-      place = 10 ** (@digits_max - 1 - @index)
 
-      n = @number / place % 10
 
-      @number -= n * place
 
-      n = (n + 1) % 10 if mouse_y < @last_mouse_y
 
-      n = (n + 9) % 10 if mouse_y > @last_mouse_y
 
-      @number += n * place
 
-      refresh
 
-      @last_mouse_y = mouse_y
 
-    end
 
-  end
 
- end
 
- class Scene_File
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    mouse_x, mouse_y = Mouse.get_mouse_pos
 
-    Mouse.click_lock
 
-    idx = 0
 
-    for i in @savefile_windows
 
-      top_x = i.x + 16
 
-      top_y = i.y + 16
 
-      bottom_x = top_x + i.width
 
-      bottom_y = top_y + i.height
 
-      if (mouse_x > top_x) and (mouse_y > top_y) and
 
-         (mouse_x < bottom_x) and (mouse_y < bottom_y)
 
-        i.selected = true
 
-        if @file_index != idx 
 
-          @file_index = idx
 
-          $game_system.se_play($data_system.cursor_se)
 
-        end            
 
-        Mouse.click_unlock
 
-      else
 
-        i.selected = false
 
-      end
 
-      idx += 1
 
-    end
 
-    self_update
 
-  end
 
- end
 
- class Arrow_Enemy
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    mouse_x, mouse_y = Mouse.get_mouse_pos
 
-    idx = 0
 
-    for i in $game_troop.enemies do
 
-      if i.exist?
 
-        top_x = i.screen_x - self.ox
 
-        top_y = i.screen_y - self.oy
 
-        bottom_x = top_x + self.src_rect.width
 
-        bottom_y = top_y + self.src_rect.height
 
-        if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
 
-           (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
 
-          if @index != idx
 
-            $game_system.se_play($data_system.cursor_se)
 
-            @index = idx
 
-          end
 
-        end
 
-      end
 
-      idx += 1
 
-    end
 
-    self_update
 
-  end
 
- end
 
- class Arrow_Actor
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  def update
 
-    mouse_x, mouse_y = Mouse.get_mouse_pos
 
-    idx = 0
 
-    for i in $game_party.actors do
 
-      if i.exist?
 
-        top_x = i.screen_x - self.ox
 
-        top_y = i.screen_y - self.oy
 
-        bottom_x = top_x + self.src_rect.width
 
-        bottom_y = top_y + self.src_rect.height
 
-        if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
 
-           (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
 
-          if @index != idx
 
-            $game_system.se_play($data_system.cursor_se)
 
-            @index = idx
 
-          end
 
-        end
 
-      end
 
-      idx += 1
 
-    end
 
-    self_update
 
-  end
 
- end
 
- #==============================================================================
 
- # ■ Game_Player
 
- #------------------------------------------------------------------------------
 
- #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
 
- # 本类的实例请参考 $game_player。
 
- #   鼠标控制角色的主程序
 
- #==============================================================================
 
- class Game_Player
 
-  if @self_alias == nil
 
-    alias self_update update
 
-    @self_alias = true
 
-  end
 
-  #--------------------------------------------------------------------------
 
-  # ● 得到鼠标的状态
 
-  #--------------------------------------------------------------------------
 
-  def get_mouse_sta 
 
-    return @mouse_sta
 
-  end
 
-  #--------------------------------------------------------------------------
 
-  # ● 完整鼠标系统
 
-  #--------------------------------------------------------------------------
 
-  def update
 
-    mouse_x, mouse_y = Mouse.get_mouse_pos
 
-    @mtp_x = mouse_x
 
-    @mtp_y = mouse_y
 
-    unless $game_system.map_interpreter.running? and @mouse_sta == 2 #鼠标状态不为跟随状态
 
-      #得到鼠标图标方向
 
-      $mouse_icon_id = $game_map.check_event_custom(mouse_x,mouse_y)  if not [11, 12, 13, 14, 16, 17, 18, 19].include?($mouse_icon_id)
 
-    else
 
-      #令鼠标图标为正常
 
-      $mouse_icon_id = 0 if @mouse_sta != 2
 
-    end
 
-    
 
-    #单击鼠标时进行判断寻路或跟随
 
-    
 
-      
 
-   if $game_switches[42]
 
-      if Mouse.press?(Mouse::LEFT)
 
-        for event in $game_map.events.values
 
-          if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
 
-          end
 
-        end
 
-      end
 
-      self_update
 
-      return
 
-    end
 
-    
 
-   # if Mouse.trigger?(Mouse::RIGHT) 
 
-    if Mouse.trigger?(Mouse::LEFT) #当点击鼠标时
 
-      unless $game_system.map_interpreter.running? or
 
-             @move_route_forcing or $game_temp.message_window_showing #各种无效情况的排除
 
-        #初始化
 
 
-        if $game_rect
 
-          return if mouse_x>=$game_rect.x and mouse_x<$game_rect.x+$game_rect.width and
 
-             mouse_y>=$game_rect.y and mouse_y<$game_rect.y+$game_rect.height
 
-           end
 
-        @mouse_sta = 1
 
-        p_direction = 5
 
-        #检查鼠标处能否开启事件
 
-        event_start,p_direction = $game_map.check_event_custom_start(mouse_x, mouse_y)
 
-        #若在移动中再次点击鼠标左键(即双击左键),则改鼠标状态为跟随状态
 
-        @mouse_sta = 2 if @paths_id != nil and @paths_id != @paths.size
 
-        if @mouse_sta != 2
 
-          #鼠标状态不为跟随状态则取数据并初始化路径
 
-          trg_x = (mouse_x + $game_map.display_x / 4) / 32
 
-          trg_y = (mouse_y + $game_map.display_y / 4) / 32
 
-          @paths = []
 
-          @paths_id = 0
 
-          if event_start == 0 #若不能开启事件
 
-            if trg_x != $game_player.x or trg_y != $game_player.y #若目标不为自身则开始寻路
 
-             #点中了宝宝
 
-             if mouse_x> 989 and mouse_x< 430 and mouse_y> 0 and mouse_y< 41
 
-               #点中了宝宝
 
-               $scene = Scene_Baby.new
 
-             #点中了人物
 
-             elsif mouse_x> 910 and mouse_x< 564 and mouse_y> 0 and mouse_y< 53
 
-               common_event_id = 17
 
-               common_event = $data_common_events[common_event_id]
 
-               $game_system.map_interpreter.setup(common_event.list, 0)
 
-             #选中了道具
 
-             elsif mouse_x> 916 and mouse_x< 41 and mouse_y> 80 and mouse_y< 112
 
-               $scene = Scene_Item.new
 
-             #选中了任务
 
-             elsif mouse_x> 948 and mouse_x< 73 and mouse_y> 80 and mouse_y< 112
 
-               $scene = Scene_Task.new
 
-             #选中了系统
 
-             elsif mouse_x> 980 and mouse_x< 105 and mouse_y> 80 and mouse_y< 112
 
-               $scene = Scene_Menu.new
 
-             #选中了BB血槽
 
-             elsif mouse_x> 933 and mouse_x< 505 and mouse_y> 0 and mouse_y< 13
 
-               if $game_party.actors[0].baby != 0
 
-                 baby = $game_actors[$game_party.actors[0].baby]
 
-                 item_id = [2,11,16,17,18,19,20,21,22,23,34,35]
 
-                 if baby.hp < baby.maxhp
 
-                   for i in item_id
 
-                     if $game_party.item_number(i) > 0
 
-                       item = $data_items[i]
 
-                       num = [(baby.maxhp - baby.hp) / item.recover_hp + 1,$game_party.item_number(i)].min
 
-                       for n in 0...num
 
-                         if baby.hp == 0
 
-                           baby.hp = 1
 
-                         end
 
-                         baby.item_effect(item)
 
-                       end
 
-                       $game_party.lose_item(i, num)
 
-                       $game_system.se_play(item.menu_se)
 
-                       $scene.update_head
 
-                       break
 
-                     end
 
-                   end
 
-                 end
 
-               end
 
-             #选中了BB法槽
 
-             elsif mouse_x> 933 and mouse_x< 505 and mouse_y> 15 and mouse_y< 29
 
-               if $game_party.actors[0].baby != 0
 
-                 baby = $game_actors[$game_party.actors[0].baby]
 
-                 item_id = [12,24,25,26,27,28,29,30,31,32,33]
 
-                 if baby.sp < baby.maxsp
 
-                   for i in item_id
 
-                     if $game_party.item_number(i) > 0
 
-                       item = $data_items[i]
 
-                       num = [(baby.maxsp - baby.sp) / item.recover_sp + 1,$game_party.item_number(i)].min
 
-                       for n in 0...num
 
-                         if baby.hp == 0
 
-                           baby.hp = 1
 
-                         end
 
-                         baby.item_effect(item)
 
-                       end
 
-                       $game_party.lose_item(i, num)
 
-                       $game_system.se_play(item.menu_se)
 
-                       $scene.update_head
 
-                       break
 
-                     end
 
-                   end
 
-                 end
 
-               end
 
-             #选中了人物血槽
 
-             elsif mouse_x> 963 and mouse_x< 636 and mouse_y> 0 and mouse_y< 15
 
-                 baby = $game_party.actors[0]
 
-                 item_id = [2,11,16,17,18,19,20,21,22,23,34,35]
 
-                 if baby.hp < baby.maxhp
 
-                   for i in item_id
 
-                     if $game_party.item_number(i) > 0
 
-                       item = $data_items[i]
 
-                       num = [(baby.maxhp - baby.hp) / item.recover_hp + 1,$game_party.item_number(i)].min
 
-                       for n in 0...num
 
-                         if baby.hp == 0
 
-                           baby.hp = 1
 
-                         end
 
-                         baby.item_effect(item)
 
-                       end
 
-                       $game_party.lose_item(i, num)
 
-                       $game_system.se_play(item.menu_se)
 
-                       $scene.update_head
 
-                       break
 
-                     end
 
-                   end
 
-                 end
 
-             #选中了人物法曹
 
-             elsif mouse_x> 963 and mouse_x< 637 and mouse_y> 15 and mouse_y< 29
 
-                 baby = $game_party.actors[0]
 
-                 item_id = [12,24,25,26,27,28,29,30,31,32,33]
 
-                 if baby.sp < baby.maxsp
 
-                   for i in item_id
 
-                     if $game_party.item_number(i) > 0
 
-                       item = $data_items[i]
 
-                       num = [(baby.maxsp - baby.sp) / item.recover_sp + 1,$game_party.item_number(i)].min
 
-                       for n in 0...num
 
-                         if baby.hp == 0
 
-                           baby.hp = 1
 
-                         end
 
-                         baby.item_effect(item)
 
-                       end
 
-                       $game_party.lose_item(i, num)
 
-                       $game_system.se_play(item.menu_se)
 
-                       $scene.update_head
 
-                       break
 
-                     end
 
-                   end
 
-                 end
 
-             else
 
-               if $scene.is_a?(Scene_Map)
 
-                 Mouse.animation($data_animations[138],mouse_x + 14 + $game_map.display_x / 4, mouse_y + 10 + $game_map.display_y / 4)
 
-               end
 
-              find_path = Find_Path.new
 
-              @paths = find_path.find_player_short_path(trg_x, trg_y, @mtp_x, @mtp_y)
 
-             end
 
-           end
 
-          else #若能开启事件则改变角色朝向
 
-            @direction = p_direction
 
-          end
 
-        end
 
-      end
 
-    elsif Mouse.trigger?(Mouse::RIGHT)
 
-      unless $game_system.map_interpreter.running? or
 
-             @move_route_forcing or $game_temp.message_window_showing #各种无效情况的排除
 
-         if @mtp_x > self.screen_x
 
-            if @mtp_y - self.screen_y > - 0.4 * ( @mtp_x - self.screen_x ) and
 
-               @mtp_y - self.screen_y < 0.4 * ( @mtp_x - self.screen_x )
 
-              @direction = 6
 
-            end
 
-            if @mtp_y - self.screen_y > 0.4 * ( @mtp_x - self.screen_x ) and
 
-              @mtp_y - self.screen_y < 2.4 * ( @mtp_x - self.screen_x )
 
-              @direction = 3
 
-            end
 
-            if @mtp_y - self.screen_y < - 0.4 * ( @mtp_x - self.screen_x ) and
 
-              @mtp_y - self.screen_y > - 2.4 * ( @mtp_x - self.screen_x )
 
-              @direction = 9
 
-            end
 
-            if @mtp_y - self.screen_y > 2.4 * ( @mtp_x - self.screen_x )
 
-              @direction = 2
 
-            end
 
-            if @mtp_y - self.screen_y < - 2.4 * ( @mtp_x - self.screen_x )
 
-              @direction = 8
 
-            end
 
-          end
 
-        if @mtp_x < self.screen_x
 
-          if @mtp_y - self.screen_y > - 0.4 * ( self.screen_x - @mtp_x ) and
 
-             @mtp_y - self.screen_y < 0.4 * ( self.screen_x - @mtp_x )
 
-            @direction = 4
 
-          end
 
-          if @mtp_y - self.screen_y > 0.4 * ( self.screen_x - @mtp_x ) and
 
-            @mtp_y - self.screen_y < 2.4 * ( self.screen_x - @mtp_x )
 
-            @direction = 1
 
-          end
 
-          if @mtp_y - self.screen_y < - 0.4 * ( self.screen_x - @mtp_x ) and
 
-            @mtp_y - self.screen_y > - 2.4 * ( self.screen_x - @mtp_x )
 
-            @direction = 7
 
-          end
 
-          if @mtp_y - self.screen_y > 2.4 * ( self.screen_x - @mtp_x )
 
-            @direction = 2
 
-          end
 
-          if @mtp_y - self.screen_y < - 2.4 * ( self.screen_x - @mtp_x )
 
-            @direction = 8
 
-          end
 
-        end    
 
-      end
 
-    end
 
 
-    #开始移动
 
-    if @mouse_sta != nil and @mouse_sta == 1 #若鼠标状态为寻路状态
 
-      unless moving? or $game_system.map_interpreter.running? or
 
-             @move_route_forcing or $game_temp.message_window_showing #排除无效情况
 
-        if @paths_id != nil and @paths != nil and @paths_id <= @paths.size #若没有完成路径
 
-          case @paths[@paths_id] #判断路径
 
-          when 6
 
-            @last_move_x = true
 
-            move_right
 
-            @paths_id += 1
 
-            @direction = 6
 
-          when 4
 
-            @last_move_x = true
 
-            move_left
 
-            @paths_id += 1
 
-            @direction = 4
 
-          when 2
 
-            @last_move_x = false
 
-            move_down
 
-            @direction = 2
 
-            @paths_id += 1
 
-          when 8
 
-            @last_move_x = false
 
-            move_up
 
-            @direction = 8
 
-            @paths_id += 1
 
-          #斜四方向
 
-          when 1
 
-            @last_move_x = false
 
-            move_lower_left
 
-            @direction = 1
 
-            @paths_id += 1
 
-          when 3
 
-            @last_move_x = false
 
-            move_lower_right
 
-            @direction = 3
 
-            @paths_id += 1
 
-          when 7
 
-            @last_move_x = false
 
-            move_upper_left
 
-            @direction = 7
 
-            @paths_id += 1
 
-          when 9
 
-            @last_move_x = false
 
-            move_upper_right
 
-            @direction = 9
 
-            @paths_id += 1
 
-          end
 
-        end
 
-      end
 
-    elsif @paths != nil and @mouse_sta == 2 #当鼠标状态为跟随,且在移动中
 
-      if Mouse.press?(Mouse::LEFT) #持续按住鼠标
 
-        unless moving? or $game_system.map_interpreter.running? or
 
-               @move_route_forcing or $game_temp.message_window_showing #排除无效情况
 
-          #跟随方向判断并跟随
 
-          if @mtp_x > self.screen_x
 
-            if @mtp_y - self.screen_y > - 0.4 * ( @mtp_x - self.screen_x ) and
 
-               @mtp_y - self.screen_y < 0.4 * ( @mtp_x - self.screen_x )
 
-              move_right
 
-              $mouse_icon_id = 16
 
-              @direction = 6
 
-            end
 
-            if @mtp_y - self.screen_y > 0.4 * ( @mtp_x - self.screen_x ) and
 
-              @mtp_y - self.screen_y < 2.4 * ( @mtp_x - self.screen_x )
 
-              move_lower_right
 
-              $mouse_icon_id = 13
 
-              @direction = 3
 
-            end
 
-            if @mtp_y - self.screen_y < - 0.4 * ( @mtp_x - self.screen_x ) and
 
-              @mtp_y - self.screen_y > - 2.4 * ( @mtp_x - self.screen_x )
 
-              move_upper_right
 
-              $mouse_icon_id = 19
 
-              @direction = 9
 
-            end
 
-            if @mtp_y - self.screen_y > 2.4 * ( @mtp_x - self.screen_x )
 
-              move_down
 
-              $mouse_icon_id = 12
 
-              @direction = 2
 
-            end
 
-            if @mtp_y - self.screen_y < - 2.4 * ( @mtp_x - self.screen_x )
 
-              move_up
 
-              $mouse_icon_id = 18
 
-              @direction = 8
 
-            end
 
-          end
 
-        if @mtp_x < self.screen_x
 
-          if @mtp_y - self.screen_y > - 0.4 * ( self.screen_x - @mtp_x ) and
 
-             @mtp_y - self.screen_y < 0.4 * ( self.screen_x - @mtp_x )
 
-            move_left
 
-            $mouse_icon_id = 14
 
-            @direction = 4
 
-          end
 
-          if @mtp_y - self.screen_y > 0.4 * ( self.screen_x - @mtp_x ) and
 
-            @mtp_y - self.screen_y < 2.4 * ( self.screen_x - @mtp_x )
 
-            move_lower_left
 
-            $mouse_icon_id = 11
 
-            @direction = 1
 
-          end
 
-          if @mtp_y - self.screen_y < - 0.4 * ( self.screen_x - @mtp_x ) and
 
-            @mtp_y - self.screen_y > - 2.4 * ( self.screen_x - @mtp_x )
 
-            move_upper_left
 
-            $mouse_icon_id = 17
 
-            @direction = 7
 
-          end
 
-          if @mtp_y - self.screen_y > 2.4 * ( self.screen_x - @mtp_x )
 
-            move_down
 
-            $mouse_icon_id = 12
 
-            @direction = 2
 
-          end
 
-          if @mtp_y - self.screen_y < - 2.4 * ( self.screen_x - @mtp_x )
 
-            move_up
 
-            $mouse_icon_id = 18
 
-            @direction = 8
 
-          end
 
-        end
 
-      end
 
-    else #没状态的情况
 
-      $mouse_icon_id = 0
 
-      @mouse_sta = 0
 
-      @paths_id = @paths.size #终止寻路移动
 
-    end
 
-  end
 
-  self_update
 
-  end
 
- end
 
- Mouse.init
 
- END { Mouse.exit }