查看: 4557|回复: 0

[已经过期] 横版菜单脚本问题

[复制链接]
梦石
0
星屑
50
在线时间
135 小时
注册时间
2012-6-14
回帖
32
发表于 2014-1-16 19:38:44 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 kkwo 于 2014-1-16 19:49 编辑

如题
功能都算正常...只有一点...
就是立绘的图全都挤在第一个...

如上图
请问要改哪才能让他正常分佈?
或是有别的横版菜单脚本?
附上脚本...
[pre lang="ruby" line="1"]#==============================================================================
# ■ VXAce-RGSS3-42 メニュー画面-改2 [Ver.1.1.0]       by Claimh
#------------------------------------------------------------------------------
# メニュー画面の表示を変更します
#------------------------------------------------------------------------------
# 立ち絵は Graphics/Pictures 以下の
# Actor{アクターID} を表示します(アクター1 : Actor1.png)
#------------------------------------------------------------------------------
# ●立ち絵の変更
#   $game_actors[アクターID].m_picture = "ファイル名"
#==============================================================================


#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● ステートおよび強化/弱体のアイコンを描画
  #--------------------------------------------------------------------------
  def draw_actor_icons_r(actor, x, y, width = 96)
    icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
    x += width - 24 * icons.size
    icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
  end
  #--------------------------------------------------------------------------
  # ● アクターの立ち絵描画
  #--------------------------------------------------------------------------
  def draw_actor_menu_picture(actor, x, y, width, height, enabled = true)
    bitmap = Cache.picture(actor.m_picture)
    xx = (bitmap.width  > width)  ? ((bitmap.width - width) / 2) : 0
    ww = (bitmap.width  > width)  ? width : bitmap.width
    yy = (bitmap.height > height) ? ((bitmap.height - height) / 2) : 0
    hh = (bitmap.height > height) ? height : bitmap.height
    rect = Rect.new(xx, yy, ww, hh)
    xx = (bitmap.width  < width)  ? ((width - bitmap.width) / 2) : x
    yy = (bitmap.height < height) ? ((height - bitmap.height) / 2) : y
    contents.blt(xx, yy, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end
end

#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :m_picture             # menu立ち絵
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias setup_menu_picture setup
  def setup(actor_id)
    setup_menu_picture(actor_id)
    @m_picture = "Actor#{actor_id}"
  end
end


#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    4
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    2 #item_max
  end
end


#==============================================================================
# ■ Window_HorzMenuStatus
#==============================================================================
class Window_HorzMenuStatus < Window_HorzCommand
  WIN = false # ウィンドウ表示あり
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :pending_index            # 保留位置(並び替え用)
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y)
    @pending_index = -1
    @top_y = y
    WIN ? super(x, y) : super(x-standard_padding, y-standard_padding)
    self.opacity = 0 unless WIN
    unselect
    deactivate
  end
  #--------------------------------------------------------------------------
  # ● 先頭の桁の設定  ※Window_HorzCommandバグ回避
  #--------------------------------------------------------------------------
  def top_col=(col)
    col = 0 if col < 0
    col = (item_max / visible_line_number) - 1 if col > (item_max / visible_line_number) - 1
    self.ox = col * (item_width + spacing)
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    $game_party.members.size
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    4
  end
  #--------------------------------------------------------------------------
  # ● 表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    1
  end
  #--------------------------------------------------------------------------
  # ● 横に項目が並ぶときの空白の幅を取得
  #--------------------------------------------------------------------------
  def spacing
    return 0
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width + (WIN ? 0 : standard_padding * 2)
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ高さの取得
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - @top_y - fitting_height(1) + (WIN ? 0 : standard_padding * 2)
  end
  #--------------------------------------------------------------------------
  # ● 項目の高さを取得
  #--------------------------------------------------------------------------
  def item_height
    height - standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● 選択項目の有効状態を取得
  #--------------------------------------------------------------------------
  def current_item_enabled?
    true
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect_for_text(index)
    draw_item_background(index)
    draw_actor_status(actor, rect.x, rect.y, rect.width, rect.height-2)
  end
  #--------------------------------------------------------------------------
  # ● 背景色の取得
  #--------------------------------------------------------------------------
  def back_color
    Color.new(0, 0, 0)
  end
  #--------------------------------------------------------------------------
  # ● ステータス背景描画
  #--------------------------------------------------------------------------
  def draw_status_back(rect)
    b = Bitmap.new(rect.width, rect.height)
    r = Rect.new(0, 0, rect.width, rect.height)
    b.fill_rect(r, back_color)
    contents.blt(rect.x, rect.y, b, r, 128)
    b.dispose
  end
  #--------------------------------------------------------------------------
  # ● アクターステータス描画
  #--------------------------------------------------------------------------
  def draw_actor_status(actor, x, y, width, height)
    draw_actor_menu_picture(actor, x, y + line_height / 2, width, height - (y + line_height / 2))
    draw_status_back(Rect.new(x, y + 4, width, line_height))
    draw_actor_name( actor, x, y + 4, width)
    draw_actor_icons_r(actor, x, y + 4 + line_height * 1, width)
    y = height - line_height * 4 - 4
    draw_status_back(Rect.new(x, y, width, line_height * 4 + 4))
    draw_actor_class(actor, x, y + line_height * 0, width)
    draw_actor_level(actor, x+width-60, y + line_height * 1)
    draw_actor_hp(   actor, x+4, y + line_height * 2, width - 8)
    draw_actor_mp(   actor, x+4, y + line_height * 3, width - 8)
  end
  #--------------------------------------------------------------------------
  # ● 項目の背景を描画
  #--------------------------------------------------------------------------
  def draw_item_background(index)
    if index == @pending_index
      contents.fill_rect(item_rect(index), pending_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
    super
    $game_party.menu_actor = $game_party.members[index]
  end
  #--------------------------------------------------------------------------
  # ● 前回の選択位置を復帰
  #--------------------------------------------------------------------------
  def select_last
    select($game_party.menu_actor.index || 0)
  end
  #--------------------------------------------------------------------------
  # ● 保留位置(並び替え用)の設定
  #--------------------------------------------------------------------------
  def pending_index=(index)
    last_pending_index = @pending_index
    @pending_index = index
    redraw_item(@pending_index)
    redraw_item(last_pending_index)
  end
end

#==============================================================================
# ■ Window_MenuMap
#==============================================================================
class Window_MenuMap < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, Graphics.width - 160, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text(4, 0, contents_width, line_height, $game_map.display_name)
  end
end


class Sprite_MenuBack < Sprite
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(viewport, x, y, h)
    super(viewport)
    self.x = x
    self.y = y
    self.bitmap = Bitmap.new(Graphics.width, h)
    self.bitmap.fill_rect(0, 0, Graphics.width, h, Color.new(0,0,0,128))
  end
end


#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● ゴールドウィンドウの作成
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.x = Graphics.width  - @gold_window.width
    @gold_window.y = Graphics.height - @gold_window.height
    @map_window  = Window_MenuMap.new(0, @gold_window.y)
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの作成
  #--------------------------------------------------------------------------
  def create_status_window
    @status_window = Window_HorzMenuStatus.new(0, @command_window.height)
  end
end
[/pre]
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部