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

Project1

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

[已经过期] 求脚本!!!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2014-1-21
帖子
14
跳转到指定楼层
1
发表于 2014-1-24 20:26:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求鼠标脚本和对话框脚本啊!

评分

参与人数 1星屑 -50 收起 理由
myownroc -50 请善用搜索

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
246 小时
注册时间
2013-8-15
帖子
106
2
发表于 2014-1-24 21:40:58 | 只看该作者
鼠标脚本
#以下两个用来调整战斗时的手感问题,可以自己试试。
$敌人选框扩大 = 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/Icons/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 - 1
    @mouse_sprite.y = mouse_y - 1
    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 > 1024 then x = 1024 end
        if y > 768 then y = 768 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_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
            tp_index = @index
            $game_system.se_play($data_system.cursor_se)
          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.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...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.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_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
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 Mouse.press?(Mouse::LEFT)
      last_moving = moving?
      last_direction = @direction
      unless moving? or $game_system.map_interpreter.running? or
          @move_route_forcing or $game_temp.message_window_showing
        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
        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
    self_update
  end
end
Mouse.init
END { Mouse.exit }

点评

看上去,我找的和你的一样,为什么你的有bug...  发表于 2014-1-24 21:53
而且有bug  发表于 2014-1-24 21:45
这个脚本要在Graphics\Icons\ 下放一个叫做mouse的图片文件  发表于 2014-1-24 21:44
.
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
246 小时
注册时间
2013-8-15
帖子
106
3
发表于 2014-1-24 21:41:58 | 只看该作者
改版后的fuki对话框脚本
class Game_Temp
  attr_accessor  :namebmp              # 调试画面 保存状态用
  attr_accessor  :map_visible          # 地图的表示状態
  attr_accessor  :run_weapon           # 武器配方   
  alias old_initialize initialize
  def initialize
    old_initialize
    @map_visible = true
    @namebmp ={}
    run_weapon = []
  end
end


def chat(id = 0,name = "")
  $mes_id = id
  $mes_name = name
end


module FUKI
  
  # SKINの設定
  FUKI_SKIN_NAME = "fk"   #
  NAME_SKIN_NAME = "fk"   # 名前表示用
  
  MES_FONT_SIZE = 18    #
  NAME_FONT_SIZE = 18   # 名前
  
  #透明度
  FUKI_OPACITY = 255    #
  MES_OPACITY = 255     # 通常の
  NAME_OPACITY = 255    # 名前
  
  # 名前の相対位置
  NAME_SHIFT_X = 0    # 横位置
  NAME_SHIFT_Y = 16   # 縦位置

  # 画面の一番端ではふきだしを少しずらす
  # 角の丸いスキンを使っていて、枠の角がふきだしと重なる場合に true にする
  CORNER_SHIFT = false
  SHIFT_PIXEL = 4   # trueの時にずらすピクセル数
  
  # キャラクターの縦のサイズ
  CHARACTOR_HEIGHT = 48
  # ふきだしの相対位置(縦位置)
  POP_SHIFT_TOP = 0     # 表示位置が上のとき
  POP_SHIFT_UNDER = -16   # 表示位置が下のとき
  
  # メッセージ表示速度(数字が小さいほど速い。0で瞬間表示)
  # $mes_speedに数値を代入することで、ゲーム中に変更可。
  MES_SPEED = 1

end
#==============================================================================
# □ Window_FukiMessage
#==============================================================================

class Window_Message < Window_Selectable

  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(80, 304, 480, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z = 9998
    @fade_in = false
    @fade_out = false
    @contents_showing = false
    @cursor_width = 0
    self.active = false
    self.index = -1
    @w = 0
    @h = 0
    @Wait = 0
    @dx = 0
    @dy = 0
    $mes_speed = FUKI::MES_SPEED
  end
  #--------------------------------------------------------------------------
  # ○ サイズを決定してウインドウを作成
  #--------------------------------------------------------------------------
  def refresh_create
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = FUKI::MES_FONT_SIZE
    # ウインドウサイズを取得
    get_windowsize
    w = @w + 32 + 8
    h = @h * (self.contents.font.size + 10) + 26
    # ふきだしウインドウを作成
    set_fukidasi(self.x, self.y, w, h)
    # 名前ウインドウを作成
    set_namewindow
    # メッセージ表示用変数の初期化
    @dx = @dy = 0
    @cursor_width = 0
    @contents_drawing = true
    # 瞬間表示の場合、ここで表示処理
    if $mes_speed == 0
      # 描画処理をループ
      while $game_temp.message_text != ""
        draw_massage
      end
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    else
      # 一文字ずつ描画
      refresh_drawtext
    end
  end
  #--------------------------------------------------------------------------
  # ○ 一文字ずつ描画
  #--------------------------------------------------------------------------
  def refresh_drawtext
    if $game_temp.message_text != nil
      if @wait > 0
        @wait -= 1
      elsif @wait == 0
        # 描画処理
        draw_massage
        @wait = $mes_speed
      end
    end
    # 描画終了
    if $game_temp.message_text == ""
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    end
  end
  #--------------------------------------------------------------------------
  # ○ ウインドウサイズを取得
  #--------------------------------------------------------------------------
  def get_windowsize
    x = y = 0
    @h = @w = 0
    @cursor_width = 0
    # 選択肢なら字下げを行う
    if $game_temp.choice_start == 0
      x = 8
    end
    # 表示待ちのメッセージがある場合
    if $game_temp.message_text != nil
    text = $game_temp.message_text.clone
      # 制御文字処理
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      # 便宜上、"\\\\" を "\000" に変換
      text.gsub!(/\\\\/) { "\000" }
      # "\\C" を "\001" に、"\\G" を "\002" に変換
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # c に 1 文字を取得 (文字が取得できなくなるまでループ)
      while ((c = text.slice!(/./m)) != nil)
        # \\ の場合
        if c == "\000"
          # 本来の文字に戻す
          c = "\\"
        end
        # \C[n] または \G の場合
        if c == "\001"  or c == "\002"
          # 次の文字へ
          next
        end
        # 改行文字の場合
        if c == "\n"
          # y に 1 を加算
          y += 1
          # 縦横サイズを取得
          @h = y
          @w = x > @w ? x : @w
          if y >= $game_temp.choice_start
            @w = x + 8 > @w ? x + 8 : @w
          end
          x = 0
          # 選択肢なら字下げを行う
          if y >= $game_temp.choice_start
            x = 8
          end
          # 次の文字へ
          next
        end
        # x に描画した文字の幅を加算
        x += self.contents.text_size(c).width
      end
    end
    # 数値入力の場合
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @h += 1
      x = digits_max * self.contents.font.size + 16
      @w = x > @w ? x : @w
    end
  end
  #--------------------------------------------------------------------------
  # ○ 描画処理
  #--------------------------------------------------------------------------
  def draw_massage
    # 表示待ちのメッセージがある場合
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      # 制御文字処理
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      # 便宜上、"\\\\" を "\000" に変換
      text.gsub!(/\\\\/) { "\000" }
      # "\\C" を "\001" に、"\\G" を "\002" に変換
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # c に 1 文字を取得
      if ((c = text.slice!(/./m)) != nil)
        # 選択肢の場合
        if @dy >= $game_temp.choice_start
          # 字下げを行う
          @dx = 8
          # 文字を描画
          self.contents.draw_text(4 + @dx, 28 * @dy, 40, 28, c)
          # x に描画した文字の幅を加算
          @dx += self.contents.text_size(c).width
          # ループ
          while ((c = text.slice!(/./m)) != "\n")
            # 文字を描画
            self.contents.draw_text(4 + @dx, 28 * @dy, 40, 28, c)
            # x に描画した文字の幅を加算
            @dx += self.contents.text_size(c).width
          end
          if c == "\n"
            # カーソルの幅を更新
            @cursor_width = [@cursor_width, @dx].max
            # y に 1 を加算
            @dy += 1
            @dx = 0
          end
          return
        end
        # \\ の場合
        if c == "\000"
          # 本来の文字に戻す
          c = "\\"
        end
        # \C[n] の場合
        if c == "\001"
          # 文字色を変更
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
        end
        # \G の場合
        if c == "\002"
          # ゴールドウィンドウを作成
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = 560 - @gold_window.width
            if $game_temp.in_battle
              @gold_window.y = 192
            else
              @gold_window.y = self.y >= 128 ? 32 : 384
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
        end
        # 改行文字の場合
        if c == "\n"
          # y に 1 を加算
          @dy += 1
          @dx = 0
        end
        # 文字を描画
        self.contents.font.size = FUKI::MES_FONT_SIZE
        font_size = self.contents.font.size
        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
        # x に描画した文字の幅を加算
        @dx += self.contents.text_size(c).width
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 選択肢と数値入力を有効に
  #--------------------------------------------------------------------------
  def draw_opt_text
    # 選択肢の場合
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    # 数値入力の場合
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 28
    end
  end
  #--------------------------------------------------------------------------
  # ○ ふきだしを表示
  #--------------------------------------------------------------------------
  def set_fukidasi(x, y, width, height)
    # $mes_id が空のときはふきだしを表示しない
    if $mes_id == nil or $mes_id == ""
      del_fukidasi
      reset_window
    else
      # ポーズサインを非表示
      self.pause = false
      # キャラクターを取得
      if $mes_id=="2"
        character = $game_allies[1]
      else
        character = get_character($mes_id)
      end
      if character == nil
        # キャラクターが存在しないときは通常のメッセージウインドウに
        del_fukidasi
        reset_window
        return
      end
      # マップがスクロールされていないときの座標処理
      if $game_map.display_x == 0
        x = character.x * 32 - (width / 2) + 16
      elsif $game_map.display_x == ($game_map.width - 20) * 128
        x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32 - (width / 2) + 16
      else
        x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32 - (width / 2)
      end
      # はみ出すときは画面内に収まるように移動
      if x + width > 640
        x = 640 - width
      elsif x < 0
        x = 0
      end
      # ウインドウの位置を決定
      up_or_down = $game_system.message_position
      case $game_system.message_position
        when 0  # 上
          y = ( (character.real_y - $game_map.display_y + 64) / 128) * 32 - height + 16 - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
          if y < 40
            y =  ( (character.real_y - $game_map.display_y + 64) / 128) * 32 + 48 + FUKI::POP_SHIFT_UNDER
            up_or_down = 2
          end
        when 1  # 中
          y = (480 - height) / 2
          x = (640 - width) / 2
        when 2  # 下
          y =  ( (character.real_y - $game_map.display_y + 64) / 128) * 32 + 48 + FUKI::POP_SHIFT_UNDER
          if y > 400
            y = ( (character.real_y - $game_map.display_y + 64) / 128) * 32 - height + 16 - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP         
            up_or_down = 0
          end
      end
      skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
      self.windowskin = RPG::Cache.windowskin(skin)
      self.x = x
      self.y = y
      self.height = height
      self.width = width
      self.contents.dispose
      self.contents = Bitmap.new(width - 32, height - 32)
      self.back_opacity = FUKI::FUKI_OPACITY
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.font.size = FUKI::MES_FONT_SIZE
      if $game_system.message_frame == 0
        @fuki = Sprite.new
        case up_or_down
          when 0  # 上
            @fuki.bitmap = RPG::Cache.windowskin(skin + "-top")
            if $game_map.display_x == 0
              @fuki.x = character.x * 32
            elsif $game_map.display_x == ($game_map.width - 20) * 128
              @fuki.x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32
            else
              @fuki.x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32 - 16
            end
            if FUKI::CORNER_SHIFT
              if @fuki.x == 0
                @fuki.x = FUKI::SHIFT_PIXEL
              elsif @fuki.x == 640 - 32
                @fuki.x = 640 - 32 - FUKI::SHIFT_PIXEL
              end
            end
            @fuki.y = y + height - 16
            @fuki.z = self.z + 1
          when 1  # 中
            @fuki.dispose
            @fuki = nil
          when 2  # 下
            @fuki.bitmap = RPG::Cache.windowskin(skin + "-under")
            if $game_map.display_x == 0
              @fuki.x = character.x * 32
            elsif $game_map.display_x == ($game_map.width - 20) * 128
              @fuki.x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32
            else
              @fuki.x = ( character.real_x - $game_map.display_x + 64 ) / 128  * 32 - 16
            end
            if FUKI::CORNER_SHIFT
              if @fuki.x == 0
                @fuki.x = FUKI::SHIFT_PIXEL
              elsif @fuki.x == 640 - 32
                @fuki.x = 640 - 32 - FUKI::SHIFT_PIXEL
              end
            end
            @fuki.y = y - 16
            @fuki.z = self.z + 1
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 名前ウインドウを表示
  #--------------------------------------------------------------------------
  def set_namewindow
    if $mes_name == nil or $mes_name == ""
      return
    else
      mes_name = $mes_name
      name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE - 4
      name_height = FUKI::NAME_FONT_SIZE+4
      name_x = x + width - 58 + FUKI::NAME_SHIFT_X
      name_y = y - name_height - 16 + FUKI::NAME_SHIFT_Y
      
      #判断名称是否有对应的图片"Graphics/heads/" +
      if $game_temp.namebmp[mes_name] == nil then
        sFile = 'notfile'
      else
        sFile = "Graphics/heads/"+$game_temp.namebmp[mes_name] + ".png"
      end
      
      if File.exist?(sFile ) == true then
        bmp1 = Bitmap.new(sFile)
        iwidth = bmp1.width
        iheight = bmp1.height
        if self.x>640-self.x-self.width
          @name_win = Window_Base.new(self.x-iwidth-5, name_y, iwidth + 5, iheight + 5)
          @name_win.y = self.y+self.height/2 - @name_win.height/2
          skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
          @name_win.windowskin = RPG::Cache.windowskin(skin)
          @name_win.back_opacity =0     
          @name_win.z = self.z + 1
          viewport = Viewport.new(@name_win.x+3, @name_win.y+1, iwidth, iheight)
          @name_contents = Sprite.new(viewport)
          @name_contents.bitmap = Bitmap.new(sFile)
          viewport.z = @name_win.z - 1
          @name_contents.z = @name_win.z + 2               
        else
          @name_win = Window_Base.new(self.x+self.width, name_y, iwidth + 5, iheight + 5)
          @name_win.y = self.y+self.height/2 - @name_win.height/2
          skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
          @name_win.windowskin = RPG::Cache.windowskin(skin)
          @name_win.back_opacity =0     
          @name_win.z = self.z + 1
          viewport = Viewport.new(@name_win.x+3, @name_win.y+1, iwidth, iheight)
          @name_contents = Sprite.new(viewport)
          @name_contents.bitmap = Bitmap.new(sFile)
          viewport.z = @name_win.z - 1
          @name_contents.z = @name_win.z + 2                 
        end               
      else
        @name_win = Window_Base.new(name_x, name_y, name_width, name_height)
        skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
        @name_win.windowskin = RPG::Cache.windowskin(skin)
        @name_win.back_opacity = FUKI::NAME_OPACITY  
        @name_win.z = self.z + 1
        rect = self.contents.text_size(mes_name)
        @name_win.width = rect.width + 16
        rect.y +=4
        @name_win.height += 8        
        rect.x +=6
        @name_win.x = self.x + self.width - @name_win.width
        viewport = Viewport.new(@name_win.x, @name_win.y, @name_win.width+32, @name_win.height)
        viewport.z = @name_win.z + 1
        @name_contents = Sprite.new(viewport)
        @name_contents.bitmap = Bitmap.new(name_width, name_height)
        @name_contents.z = @name_win.z + 2
        @name_contents.bitmap.font.color = normal_color
        @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
        @name_contents.bitmap.draw_text(rect, mes_name)
      end      
    end
  end
  #--------------------------------------------------------------------------
  # ○ ふきだしと名前ウインドウを破棄
  #--------------------------------------------------------------------------
  def del_fukidasi
    if @fuki != nil
      @fuki.dispose
      @fuki = nil
    end
    if @name_win != nil
      @name_win.dispose
      @name_win = nil
      @name_contents.dispose
      @name_contents = nil
    end
    self.opacity = 0
    self.x = 80
    self.width = 480
    self.height = 160
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, height - 32)
    self.pause = true
  end
  #--------------------------------------------------------------------------
  # ○ キャラクターの取得
  #     parameter : パラメータ
  #--------------------------------------------------------------------------
  def get_character(parameter)
    # パラメータで分岐
    case parameter
    when -1  # プレイヤー
      return $game_player
    when 0  # このイベント
      events = $game_map.events
      return events == nil ? nil : events[$active_event_id]
    else  # 特定のイベント
      events = $game_map.events
      return events == nil ? nil : events[parameter]
    end
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウの位置と不透明度の設定
  #--------------------------------------------------------------------------
  def reset_window
    if $game_temp.in_battle
      self.y = 16
    else
      case $game_system.message_position
      when 0  # 上
        self.y = 16
      when 1  # 中
        self.y = 160
      when 2  # 下
        self.y = 304
      end
    end
    if $game_system.message_frame == 0
      self.opacity = 255
    else
      self.opacity = 0
    end
    self.back_opacity = FUKI::MES_OPACITY
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    # フェードインの場合
    if @fade_in
      self.contents_opacity += 24
      if @name_win != nil
        @name_win.opacity += 24
      end
      if @fuki != nil
        @fuki.opacity += 24
      end
      if @input_number_window != nil
        @input_number_window.contents_opacity += 24
      end
      if self.contents_opacity == 255
        @fade_in = false
      end
      return
    end
    # メッセージ表示中の場合
    if @contents_drawing
      refresh_drawtext
      return
    end
    # 数値入力中の場合
    if @input_number_window != nil
      @input_number_window.update
      # 決定
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        $game_variables[$game_temp.num_input_variable_id] =
          @input_number_window.number
        $game_map.need_refresh = true
        # 数値入力ウィンドウを解放
        @input_number_window.dispose
        @input_number_window = nil
        terminate_message
      end
      return
    end
    # メッセージ表示終了の場合
    if @contents_showing_end
      # 選択肢の表示中でなければポーズサインを表示
      # ふきだしモードでは非表示
      if $game_temp.choice_max == 0 and @fuki == nil
        self.pause = true
      else
        self.pause = false
      end
      # キャンセル
      if Input.trigger?(Input::B)
        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
          terminate_message
        end
      end
      # 決定
      if Input.trigger?(Input::C)
        if $game_temp.choice_max > 0
          $game_system.se_play($data_system.decision_se)
          $game_temp.choice_proc.call(self.index)
        end
        terminate_message
        # ふきだしを破棄
        del_fukidasi
      end
      return
    end
    # フェードアウト中以外で表示待ちのメッセージか選択肢がある場合
    if @fade_out == false and $game_temp.message_text != nil
      @contents_showing = true
      $game_temp.message_window_showing = true
      reset_window
      refresh_create
      if @name_win != nil
        @name_win.opacity = 0
      end
      if @fuki != nil
        @fuki.opacity = 0
      end
      Graphics.frame_reset
      self.visible = true
      self.contents_opacity = 0
      if @input_number_window != nil
        @input_number_window.contents_opacity = 0
      end
      @fade_in = true
      return
    end
    # 表示すべきメッセージがないが、ウィンドウが可視状態の場合
    if self.visible
      @fade_out = true
      self.opacity -= 48
      if @name_win != nil
        @name_win.opacity -= 48
      end
      if @fuki != nil
        @fuki.opacity -= 48
      end
      if self.opacity == 0
        self.visible = false
        @fade_out = false
        $game_temp.message_window_showing = false
        del_fukidasi
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ○ 解放
  #--------------------------------------------------------------------------
  def dispose
    terminate_message
    $game_temp.message_window_showing = false
    if @input_number_window != nil
      @input_number_window.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # ○ メッセージ終了処理
  #--------------------------------------------------------------------------
  def terminate_message
    self.active = false
    self.pause = false
    self.index = -1
    self.contents.clear
    # 表示中フラグをクリア
    @contents_showing = false
    @contents_showing_end = false
    # メッセージ コールバックを呼ぶ
    if $game_temp.message_proc != nil
      $game_temp.message_proc.call
    end
    # 文章、選択肢、数値入力に関する変数をクリア
    $game_temp.message_text = nil
    $game_temp.message_proc = nil
    $game_temp.choice_start = 99
    $game_temp.choice_max = 0
    $game_temp.choice_cancel_type = 0
    $game_temp.choice_proc = nil
    $game_temp.num_input_start = 99
    $game_temp.num_input_variable_id = 0
    $game_temp.num_input_digits_max = 0
    # ゴールドウィンドウを開放
    if @gold_window != nil
      @gold_window.dispose
      @gold_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # ○ カーソルの矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @Index >= 0
      n = $game_temp.choice_start + @index
      self.cursor_rect.set(8, n * 28, @cursor_width, 28)
    else
      self.cursor_rect.empty
    end
  end
end

#==============================================================================
# ■ Interpreter
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # ● イベントのセットアップ
  #     event_id : イベント ID
  #--------------------------------------------------------------------------
  alias setup_fuki setup
  def setup(list, event_id)
    setup_fuki(list, event_id)
    # 戦闘中でなければ
    if !($game_temp.in_battle)
      # イベントIDを記録
      $active_event_id = event_id
    end
  end
end


#==============================================================================
# ■ Window_InputNumber
#==============================================================================

class Window_InputNumber < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     digits_max : 桁数
  #--------------------------------------------------------------------------
  def initialize(digits_max)
    @digits_max = digits_max
    @Number = 0
    # 数字の幅からカーソルの幅を計算 (0~9 は等幅と仮定)
    dummy_bitmap = Bitmap.new(32, 32)
    dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
    @cursor_width = dummy_bitmap.text_size("0").width + 8
    dummy_bitmap.dispose
    super(0, 0, @cursor_width * @digits_max + 28, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = FUKI::MES_FONT_SIZE
    self.z += 9999
    self.opacity = 0
    @index = 0
    refresh
    update_cursor_rect
  end
end

#==============================================================================
# ■ Window_Gold
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    height = FUKI::MES_FONT_SIZE + 32
    super(0, 0, 160, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = FUKI::MES_OPACITY
    self.contents.font.size = FUKI::MES_FONT_SIZE
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, FUKI::MES_FONT_SIZE, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, FUKI::MES_FONT_SIZE, $data_system.words.gold, 2)
  end
end
.
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2744
在线时间
2630 小时
注册时间
2013-1-16
帖子
5657

贵宾

4
发表于 2014-1-24 21:46:57 | 只看该作者
@星星人 这里有个更好的...
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  5. $敌人选框扩大 = 20
  6. $角色选框扩大 = 30


  7. #==============================================================================
  8. # API调用
  9. #==============================================================================
  10. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  11. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  12. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  13. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  14. $Window_HWND = $GetActiveWindow.call
  15. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  16. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  17. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  18. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  19. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  20. #$Window_HWND = $FindWindow.call(nil, 'mousetry')

  21. module Mouse  
  22.   LEFT = 0x01
  23.   RIGHT = 0x02

  24.   def self.init(sprite = nil)
  25. #   $HookStart.call($Window_HWND)
  26.     $ShowCursor.call(0)
  27.    
  28.     @show_cursor = false
  29.    
  30.     @mouse_sprite = Sprite.new
  31.     @mouse_sprite.z = 99999
  32.     @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/光标.png')
  33.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

  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. class Window_Selectable
  198.   if @self_alias == nil
  199.     alias self_update update
  200.     @self_alias = true
  201.   end
  202.   def update
  203.     #self.cursor_rect.empty
  204.     self_update
  205.     if self.active and @item_max > 0
  206.       index_var = @index
  207.       tp_index = @index
  208.       mouse_x, mouse_y = Mouse.get_mouse_pos
  209.       mouse_not_in_rect = true
  210.       for i in 0...@item_max
  211.         [url=home.php?mod=space&uid=370741]@Index[/url] = i
  212.         update_cursor_rect
  213.         top_x = self.cursor_rect.x + self.x + 16
  214.         top_y = self.cursor_rect.y + self.y + 16
  215.         bottom_x = top_x + self.cursor_rect.width
  216.         bottom_y = top_y + self.cursor_rect.height
  217.         if (mouse_x > top_x) and (mouse_y > top_y) and
  218.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  219.           mouse_not_in_rect = false
  220.           if tp_index != @index
  221.             tp_index = @index
  222.             $game_system.se_play($data_system.cursor_se)
  223.           end
  224.           break
  225.         end
  226.       end
  227.       if mouse_not_in_rect
  228.         @index = index_var
  229.         update_cursor_rect
  230.         Mouse.click_lock
  231.       else
  232.         Mouse.click_unlock               
  233.       end
  234.     end
  235.   end
  236. end
  237. class Window_NameInput
  238.   if @self_alias == nil
  239.     alias self_update update
  240.     @self_alias = true
  241.   end
  242.   def update
  243.     #self.cursor_rect.empty
  244.     self_update
  245.     if self.active
  246.       index_var = @index
  247.       mouse_x, mouse_y = Mouse.get_mouse_pos
  248.       mouse_not_in_rect = true
  249.       for i in (0...CHARACTER_TABLE.size).to_a.push(180)
  250.         @index = i
  251.         update_cursor_rect
  252.         top_x = self.cursor_rect.x + self.x + 16
  253.         top_y = self.cursor_rect.y + self.y + 16
  254.         bottom_x = top_x + self.cursor_rect.width
  255.         bottom_y = top_y + self.cursor_rect.height
  256.         #
  257.         if (mouse_x > top_x) and (mouse_y > top_y) and
  258.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  259.           mouse_not_in_rect = false
  260.           break
  261.         end
  262.       end
  263.       if mouse_not_in_rect
  264.         @index = index_var
  265.         update_cursor_rect
  266.         Mouse.click_lock
  267.       else
  268.         Mouse.click_unlock
  269.       end
  270.     end
  271.   end
  272. end
  273. class Window_InputNumber
  274.   if @self_alias == nil
  275.     alias self_update update
  276.     @self_alias = true
  277.   end
  278.   def update
  279.     #self.cursor_rect.empty
  280.     self_update
  281.     mouse_x, mouse_y = Mouse.get_mouse_pos
  282.     if self.active and @digits_max > 0
  283.       index_var = @index
  284.       mouse_not_in_rect = true
  285.       for i in 0...@digits_max
  286.         @index = i
  287.         update_cursor_rect
  288.         top_x = self.cursor_rect.x + self.x + 16
  289.         bottom_x = top_x + self.cursor_rect.width
  290.         #
  291.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  292.           mouse_not_in_rect = false
  293.           break
  294.         end
  295.       end
  296.       if mouse_not_in_rect
  297.         @index = index_var
  298.         update_cursor_rect
  299.         Mouse.click_lock
  300.       else
  301.         Mouse.click_unlock
  302.       end
  303.     end
  304.     if @last_mouse_y == nil
  305.       @last_mouse_y = mouse_y
  306.     end
  307.     check_pos = (@last_mouse_y - mouse_y).abs
  308.     if check_pos > 10
  309.       $game_system.se_play($data_system.cursor_se)
  310.       place = 10 ** (@digits_max - 1 - @index)
  311.       n = [url=home.php?mod=space&uid=27178]@Number[/url] / place % 10
  312.       @number -= n * place
  313.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  314.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  315.       @number += n * place
  316.       refresh
  317.       @last_mouse_y = mouse_y
  318.     end
  319.   end
  320. end
  321. class Scene_File
  322.   if @self_alias == nil
  323.     alias self_update update
  324.     @self_alias = true
  325.   end
  326.   def update
  327.     mouse_x, mouse_y = Mouse.get_mouse_pos
  328.     Mouse.click_lock
  329.     idx = 0
  330.     for i in @savefile_windows
  331.       top_x = i.x + 16
  332.       top_y = i.y + 16
  333.       bottom_x = top_x + i.width
  334.       bottom_y = top_y + i.height
  335.       if (mouse_x > top_x) and (mouse_y > top_y) and
  336.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  337.         i.selected = true
  338.         if @file_index != idx
  339.           @file_index = idx
  340.           $game_system.se_play($data_system.cursor_se)
  341.         end            
  342.         Mouse.click_unlock
  343.       else
  344.         i.selected = false
  345.       end
  346.       idx += 1
  347.     end
  348.     self_update
  349.   end
  350. end
  351. class Arrow_Enemy
  352.   if @self_alias == nil
  353.     alias self_update update
  354.     @self_alias = true
  355.   end
  356.   def update
  357.     mouse_x, mouse_y = Mouse.get_mouse_pos
  358.     idx = 0
  359.     for i in $game_troop.enemies do
  360.       if i.exist?
  361.         top_x = i.screen_x - self.ox
  362.         top_y = i.screen_y - self.oy
  363.         bottom_x = top_x + self.src_rect.width
  364.         bottom_y = top_y + self.src_rect.height
  365.         if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
  366.            (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
  367.           if @index != idx
  368.             $game_system.se_play($data_system.cursor_se)
  369.             @index = idx
  370.           end
  371.         end
  372.       end
  373.       idx += 1
  374.     end
  375.     self_update
  376.   end
  377. end
  378. class Arrow_Actor
  379.   if @self_alias == nil
  380.     alias self_update update
  381.     @self_alias = true
  382.   end
  383.   def update
  384.     mouse_x, mouse_y = Mouse.get_mouse_pos
  385.     idx = 0
  386.     for i in $game_party.actors do
  387.       if i.exist?
  388.         top_x = i.screen_x - self.ox
  389.         top_y = i.screen_y - self.oy
  390.         bottom_x = top_x + self.src_rect.width
  391.         bottom_y = top_y + self.src_rect.height
  392.         if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
  393.            (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
  394.           if @index != idx
  395.             $game_system.se_play($data_system.cursor_se)
  396.             @index = idx
  397.           end
  398.         end
  399.       end
  400.       idx += 1
  401.     end
  402.     self_update
  403.   end
  404. end
  405. class Game_Player
  406.   if @self_alias == nil
  407.     alias self_update update
  408.     @self_alias = true
  409.   end
  410.   def update
  411.     mouse_x, mouse_y = Mouse.get_mouse_pos

  412.     if @last_move_x == nil
  413.       @last_move_x = false
  414.     end
  415.     if Mouse.press?(Mouse::LEFT)
  416.       last_moving = moving?
  417.       last_direction = @direction
  418.       unless moving? or $game_system.map_interpreter.running? or
  419.              @move_route_forcing or $game_temp.message_window_showing
  420.         last_x = @x
  421.         if @last_move_x
  422.           @last_move_x = false
  423.         elsif mouse_x > screen_x + 16
  424.           move_right
  425.         elsif mouse_x < screen_x - 16
  426.           move_left
  427.         end
  428.         last_y = @y
  429.         if last_x != @x
  430.           @last_move_x = true
  431.         elsif mouse_y > screen_y
  432.           move_down
  433.         elsif mouse_y < screen_y - 32
  434.           move_up
  435.         end
  436.         if last_y != @y
  437.           @last_move_x = false
  438.         elsif not @last_move_x
  439.           case last_direction
  440.           when 2
  441.             turn_down
  442.           when 4
  443.             turn_left
  444.           when 6
  445.             turn_right
  446.           when 8
  447.             turn_up
  448.           end
  449.         end
  450.       end
  451.     end
  452.     self_update
  453.   end
  454. end
  455. Mouse.init
  456. END { Mouse.exit }




  457. #==============================================================================
  458. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  459. #==============================================================================
复制代码

点评

使用时要在指定文件夹放一个光标文件...  发表于 2014-1-24 21:52
我也是个脚本盲  发表于 2014-1-24 21:48
(Created by @喵kano)


施工现场:hotege.github.io
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2014-1-21
帖子
14
5
 楼主| 发表于 2014-1-24 23:10:29 | 只看该作者
怎么感觉你们的都有BUG
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
112
在线时间
136 小时
注册时间
2012-7-25
帖子
339
6
发表于 2014-1-24 23:22:53 手机端发表。 | 只看该作者
都有很多不同的版本,还有就是伸手不要这么明显
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 10:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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