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

Project1

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

[转载发布] 【转载】鼠标插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
841
在线时间
86 小时
注册时间
2020-9-5
帖子
78
跳转到指定楼层
1
发表于 2020-9-9 12:48:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 学霸小凯 于 2020-9-9 18:32 编辑

鼠标的话在游戏文件/Graphics目录新建一个叫做Mouse的文件夹,文件夹里放入一个叫做Mouse的图片,
图片:
$敌人选框扩大 = 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')
#$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
#$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
#$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
#$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
#$Window_HWND = $FindWindow.call(nil, 'mousetry')

module Mouse  
  LEFT = 0x01
  RIGHT = 0x02

  def self.init(sprite = nil)
#   $HookStart.call($Window_HWND)
    $ShowCursor.call(0)
   
    @show_cursor = false
   
    @mouse_sprite = Sprite.new
    @mouse_sprite.z = 99999
    @mouse_sprite.bitmap = Bitmap.new('Graphics/Mouse/Mouse.png')
    #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

    @left_press = false
    @right_press = false
    @left_trigger = false
    @right_trigger = false
    @left_repeat = false
    @right_repeat = false
    @click_lock = false
   
    update
  end
  def self.exit
    @mouse_sprite.bitmap.dispose
    @mouse_sprite.dispose
    @show_cursor = true
#    $HookEnd.call
    $ShowCursor.call(1)
  end
  def self.mouse_debug
    return @mouse_debug.bitmap
  end
  def self.update
    left_down = $GetKeyState.call(0x01)
    right_down = $GetKeyState.call(0x02)
   
    @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.cursor_rect.empty
    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
        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
        
          top_x += self.x_mod
          top_y += self.y_mod
          bottom_x += self.x_mod
          bottom_y += self.y_mod
        
        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
            tp_index = @index
            $data_system.sounds[0].play
          end
          break
        end
      end
    if Input.trigger?(Input::F9)
    p top_x,top_y,Mouse.get_mouse_pos
    end
      if mouse_not_in_rect
        @index = index_var
        update_cursor
        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.cursor_rect.empty
    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...HIRAGANA.size).to_a.push(180)
        @index = i
        update_cursor
        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
        Mouse.click_lock
      else
        Mouse.click_unlock
      end
    end
  end
end
=begin

class Window_InputNumber
  if @self_alias == nil
    alias self_update update
    @self_alias = true
  end
  def update
    #self.cursor_rect.empty
    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
        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
        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
=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
          $data_system.sounds[0].play
        end            
        Mouse.click_unlock
      else
        i.selected = false
      end
      idx += 1
    end
    self_update
  end
end

class Game_Player
  if @self_alias == nil
    alias self_update update
    @self_alias = true
  end
  def update
    mouse_x, mouse_y = Mouse.get_mouse_pos
    if @last_move_x == nil
      @last_move_x = false
    end
    if $game_switches[123]
     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
           event.start
         end
       end
     end
     self_update
     return
   end
    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
   #event.start
   #end
   #end
      last_moving = moving?
      last_direction = @direction
    #  return unless movable?
    #  return if $game_map.interpreter.running?
      unless moving? or $game_map.interpreter.running?
      last_x = @x
        if @last_move_x
          @last_move_x = false
        elsif mouse_x > screen_x + 16
          move_right
        elsif mouse_x < screen_x - 16
          move_left
        end
        last_y = @y
        if last_x != @x
          @last_move_x = true
        elsif mouse_y > screen_y
          move_down
        elsif mouse_y < screen_y - 32
          move_up
        end
=begin        
        if last_y != @y
          @last_move_x = false
        elsif not @last_move_x
          case last_direction
          when 2
            turn_down
          when 4
            turn_left
          when 6
            turn_right
          when 8
            turn_up
          end        
        end
=end         
      end
    end
    self_update
  end
end
Mouse.init
END { Mouse.exit }


class Window_Base < Window
  attr_accessor :x_mod
  attr_accessor :y_mod
  alias ka_initialize initialize
  def initialize(x, y, width, height)
    ka_initialize(x, y, width, height)
    self.x_mod = 0
    self.y_mod = 0
  end
end
class Window_PartyCommand < Window_Command
  alias ka1_initialize initialize
  def initialize
    ka1_initialize
    self.y_mod = 288
  end
end
class Window_ActorCommand < Window_Command
  alias ka2_initialize initialize
  def initialize
    ka2_initialize
    self.x_mod = -128
    self.y_mod = 288
  end
end

以下是脚本

评分

参与人数 1+1 收起 理由
boss9745m + 1 我很赞同

查看全部评分

Lv2.观梦者

梦石
0
星屑
841
在线时间
86 小时
注册时间
2020-9-5
帖子
78
2
 楼主| 发表于 2020-9-9 12:50:09 | 只看该作者
脚本重发:
RUBY 代码复制
  1. $敌人选框扩大 = 20
  2. $角色选框扩大 = 30
  3.  
  4. #==============================================================================
  5. # API调用
  6. #==============================================================================
  7. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  8. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  9. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  10. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  11. $Window_HWND = $GetActiveWindow.call
  12. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  13. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  14. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  15. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  16. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  17. #$Window_HWND = $FindWindow.call(nil, 'mousetry')
  18.  
  19. module Mouse  
  20.   LEFT = 0x01
  21.   RIGHT = 0x02
  22.  
  23.   def self.init(sprite = nil)
  24. #   $HookStart.call($Window_HWND)
  25.     $ShowCursor.call(0)
  26.  
  27.     @show_cursor = false
  28.  
  29.     @mouse_sprite = Sprite.new
  30.     @mouse_sprite.z = 99999
  31.     @mouse_sprite.bitmap = Bitmap.new('Graphics/Mouse/Mouse.png')
  32.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))
  33.  
  34.     @left_press = false
  35.     @right_press = false
  36.     @left_trigger = false
  37.     @right_trigger = false
  38.     @left_repeat = false
  39.     @right_repeat = false
  40.     @click_lock = false
  41.  
  42.     update
  43.   end
  44.   def self.exit
  45.     @mouse_sprite.bitmap.dispose
  46.     @mouse_sprite.dispose
  47.     @show_cursor = true
  48. #    $HookEnd.call
  49.     $ShowCursor.call(1)
  50.   end
  51.   def self.mouse_debug
  52.     return @mouse_debug.bitmap
  53.   end
  54.   def self.update
  55.     left_down = $GetKeyState.call(0x01)
  56.     right_down = $GetKeyState.call(0x02)
  57.  
  58.     @click_lock = false
  59.     mouse_x, mouse_y = self.get_mouse_pos
  60.     if @mouse_sprite != nil
  61.       @mouse_sprite.x = mouse_x
  62.       @mouse_sprite.y = mouse_y
  63.     end
  64.     if left_down[7] == 1
  65.       @left_repeat = (not @left_repeat)
  66.       @left_trigger = (not @left_press)
  67.       @left_press = true
  68.     else
  69.       @left_press = false
  70.       @left_trigger = false
  71.       @left_repeat = false
  72.     end
  73.     if right_down[7] == 1
  74.       @right_repeat = (not @right_repeat)
  75.       @right_trigger = (not @right_press)
  76.       @right_press = true
  77.     else
  78.       @right_press = false
  79.       @right_trigger = false
  80.       @right_repeat = false
  81.     end
  82.   end
  83.   def self.get_mouse_pos
  84.     point_var = [0, 0].pack('ll')
  85.     if $GetCursorPos.call(point_var) != 0
  86.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  87.         x, y = point_var.unpack('ll')
  88.         if (x < 0) or (x > 10000) then x = 0 end
  89.         if (y < 0) or (y > 10000) then y = 0 end
  90.         if x > 640 then x = 640 end
  91.         if y > 480 then y = 480 end
  92.         return x, y
  93.       else
  94.         return 0, 0
  95.       end
  96.     else
  97.       return 0, 0
  98.     end
  99.   end
  100.   def self.press?(mouse_code)
  101.     if mouse_code == LEFT
  102.       if @click_lock
  103.         return false
  104.       else
  105.         return @left_press
  106.       end
  107.     elsif mouse_code == RIGHT
  108.       return @right_press
  109.     else
  110.       return false
  111.     end
  112.   end
  113.   def self.trigger?(mouse_code)
  114.     if mouse_code == LEFT
  115.       if @click_lock
  116.         return false
  117.       else
  118.         return @left_trigger
  119.       end
  120.     elsif mouse_code == RIGHT
  121.       return @right_trigger
  122.     else
  123.       return false
  124.     end
  125.   end
  126.   def self.repeat?(mouse_code)
  127.     if mouse_code == LEFT
  128.       if @click_lock
  129.         return false
  130.       else
  131.         return @left_repeat
  132.       end
  133.     elsif mouse_code == RIGHT
  134.       return @right_repeat
  135.     else
  136.       return false
  137.     end
  138.   end
  139.   def self.click_lock?
  140.     return @click_lock
  141.   end
  142.   def self.click_lock
  143.     @click_lock = true
  144.   end
  145.   def self.click_unlock
  146.     @click_lock = false
  147.   end
  148. end
  149. module Input
  150.   if @self_update == nil
  151.     @self_update = method('update')
  152.     @self_press = method('press?')
  153.     @self_trigger = method('trigger?')
  154.     @self_repeat = method('repeat?')
  155.   end
  156.   def self.update
  157.     @self_update.call
  158.     Mouse.update
  159.   end
  160.   def self.press?(key_code)
  161.     if @self_press.call(key_code)
  162.       return true
  163.     end
  164.     if key_code == C
  165.       return Mouse.press?(Mouse::LEFT)
  166.     elsif key_code == B
  167.       return Mouse.press?(Mouse::RIGHT)
  168.     else
  169.       return @self_press.call(key_code)
  170.     end
  171.   end
  172.   def self.trigger?(key_code)
  173.     if @self_trigger.call(key_code)
  174.       return true
  175.     end
  176.     if key_code == C
  177.       return Mouse.trigger?(Mouse::LEFT)
  178.     elsif key_code == B
  179.       return Mouse.trigger?(Mouse::RIGHT)
  180.     else
  181.       return @self_trigger.call(key_code)
  182.     end
  183.   end
  184.   def self.repeat?(key_code)
  185.     if @self_repeat.call(key_code)
  186.       return true
  187.     end
  188.     if key_code == C
  189.       return Mouse.repeat?(Mouse::LEFT)
  190.     elsif key_code == B
  191.       return Mouse.repeat?(Mouse::RIGHT)
  192.     else
  193.       return @self_repeat.call(key_code)
  194.     end
  195.   end
  196. end
  197.  
  198. class Window_Selectable
  199.   if @self_alias == nil
  200.     alias self_update update
  201.     @self_alias = true
  202.   end
  203.   def update
  204.     #self.cursor_rect.empty
  205.     self_update
  206.     if self.active and @item_max > 0
  207.       index_var = @index
  208.       tp_index = @index
  209.       mouse_x, mouse_y = Mouse.get_mouse_pos
  210.       mouse_not_in_rect = true
  211.       for i in 0...@item_max
  212.         @index = i
  213.         update_cursor
  214.         top_x = self.cursor_rect.x + self.x + 16
  215.         top_y = self.cursor_rect.y + self.y + 16
  216.         bottom_x = top_x + self.cursor_rect.width
  217.         bottom_y = top_y + self.cursor_rect.height
  218.  
  219.           top_x += self.x_mod
  220.           top_y += self.y_mod
  221.           bottom_x += self.x_mod
  222.           bottom_y += self.y_mod
  223.  
  224.         if (mouse_x > top_x) and (mouse_y > top_y) and
  225.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  226.           mouse_not_in_rect = false
  227.           if tp_index != @index
  228.             tp_index = @index
  229.             $data_system.sounds[0].play
  230.           end
  231.           break
  232.         end
  233.       end
  234.     if Input.trigger?(Input::F9)
  235.     p top_x,top_y,Mouse.get_mouse_pos
  236.     end
  237.       if mouse_not_in_rect
  238.         @index = index_var
  239.         update_cursor
  240.         Mouse.click_lock
  241.       else
  242.         Mouse.click_unlock               
  243.       end
  244.     end
  245.   end
  246. end
  247.  
  248.  
  249.  
  250.  
  251. class Window_NameInput
  252.   if @self_alias == nil
  253.     alias self_update update
  254.     @self_alias = true
  255.   end
  256.   def update
  257.     #self.cursor_rect.empty
  258.     self_update
  259.     if self.active
  260.       index_var = @index
  261.       mouse_x, mouse_y = Mouse.get_mouse_pos
  262.       mouse_not_in_rect = true
  263.       for i in (0...HIRAGANA.size).to_a.push(180)
  264.         @index = i
  265.         update_cursor
  266.         top_x = self.cursor_rect.x + self.x + 16
  267.         top_y = self.cursor_rect.y + self.y + 16
  268.         bottom_x = top_x + self.cursor_rect.width
  269.         bottom_y = top_y + self.cursor_rect.height
  270.         #
  271.         if (mouse_x > top_x) and (mouse_y > top_y) and
  272.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  273.           mouse_not_in_rect = false
  274.           break
  275.         end
  276.       end
  277.       if mouse_not_in_rect
  278.         @index = index_var
  279.         update_cursor
  280.         Mouse.click_lock
  281.       else
  282.         Mouse.click_unlock
  283.       end
  284.     end
  285.   end
  286. end
  287. =begin
  288.  
  289. class Window_InputNumber
  290.   if @self_alias == nil
  291.     alias self_update update
  292.     @self_alias = true
  293.   end
  294.   def update
  295.     #self.cursor_rect.empty
  296.     self_update
  297.     mouse_x, mouse_y = Mouse.get_mouse_pos
  298.     if self.active and @digits_max > 0
  299.       index_var = @index
  300.       mouse_not_in_rect = true
  301.       for i in 0...@digits_max
  302.         @index = i
  303.         #update_cursor
  304.         top_x = self.cursor_rect.x + self.x + 16
  305.         bottom_x = top_x + self.cursor_rect.width
  306.         #
  307.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  308.           mouse_not_in_rect = false
  309.           break
  310.         end
  311.       end
  312.       if mouse_not_in_rect
  313.         @index = index_var
  314.         #update_cursor
  315.         Mouse.click_lock
  316.       else
  317.         Mouse.click_unlock
  318.       end
  319.     end
  320.     if @last_mouse_y == nil
  321.       @last_mouse_y = mouse_y
  322.     end
  323.     check_pos = (@last_mouse_y - mouse_y).abs
  324.     if check_pos > 10
  325.       #$game_system.se_play($data_system.cursor_se)
  326.       place = 10 ** (@digits_max - 1 - @index)
  327.       n = @Number / place % 10
  328.       @number -= n * place
  329.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  330.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  331.       @number += n * place
  332.       refresh
  333.       @last_mouse_y = mouse_y
  334.     end
  335.   end
  336. end
  337. =end
  338.  
  339. class Scene_File
  340.   if @self_alias == nil
  341.     alias self_update update
  342.     @self_alias = true
  343.   end
  344.   def update
  345.     mouse_x, mouse_y = Mouse.get_mouse_pos
  346.     Mouse.click_lock
  347.     idx = 0
  348.     for i in @savefile_windows
  349.       top_x = i.x + 16
  350.       top_y = i.y + 16
  351.       bottom_x = top_x + i.width
  352.       bottom_y = top_y + i.height
  353.       if (mouse_x > top_x) and (mouse_y > top_y) and
  354.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  355.         i.selected = true
  356.         if @file_index != idx
  357.           @file_index = idx
  358.           $data_system.sounds[0].play
  359.         end            
  360.         Mouse.click_unlock
  361.       else
  362.         i.selected = false
  363.       end
  364.       idx += 1
  365.     end
  366.     self_update
  367.   end
  368. end
  369.  
  370. class Game_Player
  371.   if @self_alias == nil
  372.     alias self_update update
  373.     @self_alias = true
  374.   end
  375.   def update
  376.     mouse_x, mouse_y = Mouse.get_mouse_pos
  377.     if @last_move_x == nil
  378.       @last_move_x = false
  379.     end
  380.     if $game_switches[123]
  381.      if Mouse.press?(Mouse::LEFT)
  382.        for event in $game_map.events.values
  383.          if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
  384.            event.start
  385.          end
  386.        end
  387.      end
  388.      self_update
  389.      return
  390.    end
  391.     if Mouse.press?(Mouse::LEFT)
  392.    #for event in $game_map.events.values
  393.    #if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
  394.    #event.start
  395.    #end
  396.    #end
  397.       last_moving = moving?
  398.       last_direction = @direction
  399.     #  return unless movable?
  400.     #  return if $game_map.interpreter.running?
  401.       unless moving? or $game_map.interpreter.running?
  402.       last_x = @x
  403.         if @last_move_x
  404.           @last_move_x = false
  405.         elsif mouse_x > screen_x + 16
  406.           move_right
  407.         elsif mouse_x < screen_x - 16
  408.           move_left
  409.         end
  410.         last_y = @y
  411.         if last_x != @x
  412.           @last_move_x = true
  413.         elsif mouse_y > screen_y
  414.           move_down
  415.         elsif mouse_y < screen_y - 32
  416.           move_up
  417.         end
  418. =begin        
  419.         if last_y != @y
  420.           @last_move_x = false
  421.         elsif not @last_move_x
  422.           case last_direction
  423.           when 2
  424.             turn_down
  425.           when 4
  426.             turn_left
  427.           when 6
  428.             turn_right
  429.           when 8
  430.             turn_up
  431.           end        
  432.         end
  433. =end         
  434.       end
  435.     end
  436.     self_update
  437.   end
  438. end
  439. Mouse.init
  440. END { Mouse.exit }
  441.  
  442.  
  443. class Window_Base < Window
  444.   attr_accessor :x_mod
  445.   attr_accessor :y_mod
  446.   alias ka_initialize initialize
  447.   def initialize(x, y, width, height)
  448.     ka_initialize(x, y, width, height)
  449.     self.x_mod = 0
  450.     self.y_mod = 0
  451.   end
  452. end
  453. class Window_PartyCommand < Window_Command
  454.   alias ka1_initialize initialize
  455.   def initialize
  456.     ka1_initialize
  457.     self.y_mod = 288
  458.   end
  459. end
  460. class Window_ActorCommand < Window_Command
  461.   alias ka2_initialize initialize
  462.   def initialize
  463.     ka2_initialize
  464.     self.x_mod = -128
  465.     self.y_mod = 288
  466.   end
  467. end
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24292
在线时间
5048 小时
注册时间
2016-3-8
帖子
1618
3
发表于 2020-9-9 13:47:33 | 只看该作者
本帖最后由 alexncf125 于 2020-9-9 13:49 编辑

「原创发布」!!?

https://rpg.blue/thread-167574-1-1.html
https://rpg.blue/thread-277287-1-1.html

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-27 10:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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