Project1

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

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

下面是脚本
RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_BattleStatus
  4. #------------------------------------------------------------------------------
  5. #  战斗画面中,显示“队伍成员状态”的窗口。
  6. #==============================================================================
  7.  
  8. class Window_BattleStatus < Window_Selectable
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对象
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     super(0, 10, window_width, window_height)
  14.     refresh
  15.     self.openness = 0
  16.     self.z=2
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 获取窗口的宽度
  20.   #--------------------------------------------------------------------------
  21.   def window_width
  22.     Graphics.width #- 128
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 获取窗口的高度
  26.   #--------------------------------------------------------------------------
  27.   def window_height
  28.     fitting_height(4)
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 获取项目数
  32.   #--------------------------------------------------------------------------
  33.   def item_max
  34.     $game_party.battle_members.size
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 刷新
  38.   #--------------------------------------------------------------------------
  39.   def refresh
  40.     contents.clear
  41.     draw_all_items
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 描绘项目
  45.   #--------------------------------------------------------------------------
  46.   def draw_item(index)
  47.     rect =  item_rect(index)
  48.     rect.x += 4
  49.     rect.width -= 50#10
  50.     self.contents.clear_rect(rect)
  51.     self.contents.font.color = normal_color
  52.     actor = $game_party.members[index]
  53.     draw_actor_face(actor, rect.x-10 , rect.y-20 )#,rect.width - 50)
  54.     #draw_actor_name(actor, index * 100, rect.y + 2)
  55.     #draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  56.     draw_actor_icons(actor, index * 100 + 6, 22, 24)
  57.     draw_crhp(rect.x,rect.y+52,actor.hp,actor.mhp,"")
  58.     draw_crmp(rect.x,rect.y+68,actor.mp,actor.mmp,"")
  59.     draw_actor_tp(actor, index * 100, 60, 70)
  60.   end
  61.   #----------------------------------------------------------------------
  62.   # ● 设置光标的位置
  63.   #     index : 新的光标位置
  64.   #--------------------------------------------------------------------------
  65.   def index=(index)
  66.     @index = index
  67.     update_cursor
  68.     refresh
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 获取项目描画矩形
  72.   #     index : 项目编号
  73.   #--------------------------------------------------------------------------
  74.   def item_rect(index)
  75.     rect = Rect.new(0, 0, 0, 0)
  76.     rect.width = contents.width - 113
  77.     rect.height = 20
  78.     rect.x = index * 100
  79.     rect.y = 0
  80.     return rect
  81.   end  
  82.   #--------------------------------------------------------------------------
  83.   # ● 更新光标矩形
  84.   #--------------------------------------------------------------------------
  85.   def update_cursor   
  86.     case @index
  87.     when 0...6
  88.       self.cursor_rect.set(@index * 100, 0, 80, 96)
  89.     else
  90.       self.cursor_rect.empty        # 光标无效
  91.     end
  92.   end
  93. end

QQ截图20141118152916.png (478.59 KB, 下载次数: 24)

QQ截图20141118152916.png

作者: taroxd    时间: 2014-11-18 17:16
没记错的话,更改最大项目数的话,宽度应该会自行调整的来着
作者: hijl1990    时间: 2014-11-19 14:03
请问楼主能分享下这个选项脚本吗?




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