Project1

标题: 求教怎么修改战斗状态栏的宽度 [打印本页]

作者: RM无节操小分队    时间: 2014-11-18 15:54
标题: 求教怎么修改战斗状态栏的宽度
RT,就是我自己修改了一下战斗状态栏,加入了自制HP条与脸图,
可是我想设置一个6人战斗的时候,发现屏幕放不下,下面有截图,
就是说,让状态栏现实 480的宽度,每一个人物占用80的

下面是脚本
[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  战斗画面中,显示“队伍成员状态”的窗口。
#==============================================================================

class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 10, window_width, window_height)
    refresh
    self.openness = 0
    self.z=2
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width #- 128
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的高度
  #--------------------------------------------------------------------------
  def window_height
    fitting_height(4)
  end
  #--------------------------------------------------------------------------
  # ● 获取项目数
  #--------------------------------------------------------------------------
  def item_max
    $game_party.battle_members.size
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_all_items
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect =  item_rect(index)
    rect.x += 4
    rect.width -= 50#10
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    actor = $game_party.members[index]
    draw_actor_face(actor, rect.x-10 , rect.y-20 )#,rect.width - 50)
    #draw_actor_name(actor, index * 100, rect.y + 2)
    #draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
    draw_actor_icons(actor, index * 100 + 6, 22, 24)
    draw_crhp(rect.x,rect.y+52,actor.hp,actor.mhp,"")
    draw_crmp(rect.x,rect.y+68,actor.mp,actor.mmp,"")
    draw_actor_tp(actor, index * 100, 60, 70)
  end
  #----------------------------------------------------------------------
  # ● 设置光标的位置
  #     index : 新的光标位置
  #--------------------------------------------------------------------------
  def index=(index)
    @index = index
    update_cursor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取项目描画矩形
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = contents.width - 113
    rect.height = 20
    rect.x = index * 100
    rect.y = 0
    return rect
  end  
  #--------------------------------------------------------------------------
  # ● 更新光标矩形
  #--------------------------------------------------------------------------
  def update_cursor   
    case @index
    when 0...6
      self.cursor_rect.set(@index * 100, 0, 80, 96)
    else
      self.cursor_rect.empty        # 光标无效
    end
  end
end
[/pre]
作者: taroxd    时间: 2014-11-18 17:16
没记错的话,更改最大项目数的话,宽度应该会自行调整的来着
作者: hijl1990    时间: 2014-11-19 14:03
请问楼主能分享下这个选项脚本吗?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X5.0