Project1

标题: 求大手帮忙该脚本的窗口位置数据 [打印本页]

作者: ilovejel    时间: 2013-3-27 14:49
标题: 求大手帮忙该脚本的窗口位置数据
本帖最后由 ilovejel 于 2013-3-27 23:00 编辑

这个脚本我自己调整了下位置,但是越调越乱。。。求大手指导。。。
/////////////////////////////////////////

希望能调整成这样的

技能出现的位置也不对

一出现状态后打开技能框就会消失了一半


[pre lang="ruby" line="1" file="脚本"]#==============================================================================
# ■ DrawFvPictures : 専用ピクチャ描画モジュール
#==============================================================================
module DrawFvPictures
  #--------------------------------------------------------------------------
  # ● HP/MP/TP/Act文字 の描画
  #--------------------------------------------------------------------------
  def self.draw_bt_text(bitmap, index, x, y)
    b = Cache.system("bt_text")
    hh = b.height / 4
    bitmap.blt(x, y, b, Rect.new(0, index * hh, b.width, hh))
  end
  #--------------------------------------------------------------------------
  # ● 数字ピクチャ(1文字) の矩形 [src]
  #--------------------------------------------------------------------------
  def self.num_rect(index=0, type=0)
    b = Cache.system("number")
    ww = b.width / 10
    hh = b.height / 4
    Rect.new(index*ww, type*hh, ww, hh)
  end
  #--------------------------------------------------------------------------
  # ● 数字ピクチャ の矩形 [width, height]
  #--------------------------------------------------------------------------
  def self.text_size(num)
    if damage_type(num) == 4
      b = Cache.system(num)
      Rect.new(0, 0, b.width, b.height)
    else
      b = Cache.system("number")
      Rect.new(0, 0, num.to_s.split("").size * (b.width / 10), b.height / 4)
    end
  end
  #--------------------------------------------------------------------------
  # ● 数字ピクチャ(1文字) の描画
  #--------------------------------------------------------------------------
  def self.draw_num_picture(bitmap, x, y, height, num, type=0)
    r = num_rect(num, type)
    yy = (height - r.height) / 2
    bitmap.blt(x, y+yy, Cache.system("number"), r)
    r.width
  end
  #--------------------------------------------------------------------------
  # ● 数値ピクチャ の描画
  #--------------------------------------------------------------------------
  def self.draw_nums_picture(bitmap, x, y, width, height, num, type=0, align=2)
    nums = num.to_s.split("").collect { |i| i.to_i }
    case align
    when 1; x += (width - num_rect(0, type).width * nums.size) / 2
    when 2; x +=  width - num_rect(0, type).width * nums.size
    end
    nums.each { |n| x += draw_num_picture(bitmap, x, y, height, n, type) }
  end
  #--------------------------------------------------------------------------
  # ● ダメージ用文字ピクチャ の矩形
  #--------------------------------------------------------------------------
  def self.draw_dmg_text(bitmap, x, y, file)
    b = Cache.system(file)
    bitmap.blt(x, y, b, Rect.new(0,0,b.width,b.height))
  end
  #--------------------------------------------------------------------------
  # ● HP の文字色を取得
  #--------------------------------------------------------------------------
  def self.hp_color_type(actor)
    return 2 if actor.fv_prm.hp.current == 0
    return 1 if actor.fv_prm.hp.current < actor.mhp / 4
    return 0
  end
  #--------------------------------------------------------------------------
  # ● MP の文字色を取得
  #--------------------------------------------------------------------------
  def self.mp_color_type(actor)
    return 2 if actor.fv_prm.mp.current == 0
    return 1 if actor.fv_prm.mp.current < actor.mmp / 4
    return 0
  end
  #--------------------------------------------------------------------------
  # ● TP の文字色を取得
  #--------------------------------------------------------------------------
  def self.tp_color_type(actor)
    return 2 if actor.fv_prm.tp.current == actor.max_tp
    return 0
  end
  #--------------------------------------------------------------------------
  # ● ダメージ種別を取得
  #--------------------------------------------------------------------------
  def self.damage_type(damage, critical=false)
    if damage.is_a?(Numeric)
      return 3 if damage < 0
      return 2 if critical
      return 0
    else
      return 4  # 文字
    end
  end
  #--------------------------------------------------------------------------
  # ● ゲージピクチャ の矩形
  #--------------------------------------------------------------------------
  def self.guage_rect(type=0, rate=1.0, w=0, h=0)
    bitmap = Cache.system("guage")
    ww = (bitmap.width - w) * rate
    hh = bitmap.height / 5
    Rect.new(w/2, type*hh, ww, hh)
  end
  #--------------------------------------------------------------------------
  # ● ゲージピクチャ の描画
  #--------------------------------------------------------------------------
  def self.draw_guage_picture(bitmap, x, y, type, rate)
    bitmap.blt(x, y, Cache.system("guage"), guage_rect(0))
    bitmap.blt(x, y, Cache.system("guage"), guage_rect(type, rate, 2, 2))
    bitmap.blt(x, y, Cache.system("guage"), guage_rect(4))
  end
end


#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● HP/MP/TP/Act文字 の描画
  #--------------------------------------------------------------------------
  def draw_bt_text(index, x, y)
    DrawFvPictures.draw_bt_text(contents, index, x, y)
  end
  #--------------------------------------------------------------------------
  # ● 数値ピクチャ の描画
  #--------------------------------------------------------------------------
  def draw_nums_picture(x, y, width, num, type=0, align=2)
    DrawFvPictures.draw_nums_picture(contents, x, y, width, line_height, num, type, align)
  end
  #--------------------------------------------------------------------------
  # ● ゲージピクチャ の矩形
  #--------------------------------------------------------------------------
  def guage_rect(type=0, rate=1.0, w=0, h=0)
    DrawFvPictures.guage_rect(contents, type, rate, w, h)
  end
  #--------------------------------------------------------------------------
  # ● ゲージピクチャ の描画
  #--------------------------------------------------------------------------
  def draw_guage_picture(x, y, type, rate)
    DrawFvPictures.draw_guage_picture(contents, x, y, type, rate)
  end
end

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● HP の描画
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 124)
#~     draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
#~     change_color(system_color)
#~     draw_text(x, y, 30, line_height, Vocab::hp_a)
#~     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
#~       hp_color(actor), normal_color)
    draw_guage_picture(x+84, y-20, 1, actor.fv_prm.hp_rate)
    draw_bt_text(0, x+84, y-12)
    draw_nums_picture(x+84, y-20, width, actor.fv_prm.hp.current, DrawFvPictures.hp_color_type(actor))
  end
  #--------------------------------------------------------------------------
  # ● MP の描画
  #--------------------------------------------------------------------------
  def draw_actor_mp(actor, x, y, width = 124)
#~     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
#~     change_color(system_color)
#~     draw_text(x, y, 30, line_height, Vocab::mp_a)
#~     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
#~       mp_color(actor), normal_color)
    draw_guage_picture(x+84, y-20, 2, actor.fv_prm.mp_rate)
    draw_bt_text(1, x+84, y-12)
    draw_nums_picture(x+84, y-20, width, actor.fv_prm.mp.current, DrawFvPictures.mp_color_type(actor))
  end
  #--------------------------------------------------------------------------
  # ● TP の描画
  #--------------------------------------------------------------------------
  def draw_actor_tp(actor, x, y, width = 124)
#~     draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
#~     change_color(system_color)
#~     draw_text(x, y, 30, line_height, Vocab::tp_a)
#~     change_color(tp_color(actor))
#~     draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
    draw_guage_picture(x+84, y-20, 3, actor.fv_prm.tp_rate)
    draw_bt_text(2, x+84, y-12)
    draw_nums_picture(x+84, y-20, width, actor.fv_prm.tp.current.to_i, DrawFvPictures.tp_color_type(actor))
  end
  #--------------------------------------------------------------------------
  # ● HP の再描画
  #--------------------------------------------------------------------------
  def redraw_actor_hp(index)
    r = gauge_area_rect(index)
    r.y += gauge_line_height * 0
    r.height = gauge_line_height
    contents.clear_rect(r)
    draw_actor_hp(i_actor(index), r.x, r.y, r.width)
  end
  #--------------------------------------------------------------------------
  # ● MP の再描画
  #--------------------------------------------------------------------------
  def redraw_actor_mp(index)
    r = gauge_area_rect(index)
    r.y += gauge_line_height * 1
    r.height = gauge_line_height
    contents.clear_rect(r)
    draw_actor_mp(i_actor(index), r.x, r.y, r.width)
  end
  #--------------------------------------------------------------------------
  # ● TP の再描画
  #--------------------------------------------------------------------------
  def redraw_actor_tp(index)
#~     return unless $data_system.opt_display_tp
    r = gauge_area_rect(index)
    r.y += gauge_line_height * 2
    r.height = gauge_line_height
    contents.clear_rect(r)
    draw_actor_tp(i_actor(index), r.x, r.y, r.width)
  end
  #--------------------------------------------------------------------------
  # ● アクション文字描画
  #--------------------------------------------------------------------------
  def draw_action_text(x, y)
    change_color(system_color)
    contents.font.size = 15
    draw_bt_text(3, x, y+8)
    contents.font.size = Font.default_size
    change_color(normal_color)
  end
  #--------------------------------------------------------------------------
  # ● 戦闘コマンドアイコンの描画
  #--------------------------------------------------------------------------
  def draw_bt_cmd_icon(index, enable=true)
    rect = action_area_rect(index)
    contents.fill_rect(Rect.new(rect.x, rect.y+22, 24, 28), BtlrFv::BACK_COLOR)
    draw_action_text(rect.x, rect.y+6)
    draw_icon(i_actor(index).act_icon, rect.x, rect.y+16) if enable
  end
  #--------------------------------------------------------------------------
  # ● 戦闘コマンドアイコンの再描画
  #--------------------------------------------------------------------------
  def redraw_bt_cmd_icon(index, redraw=true)
    contents.clear_rect(action_area_rect(index))
    draw_bt_cmd_icon(index, redraw)
  end
end
[/pre]
作者: 千昭    时间: 2013-3-27 15:50
有没有范例工程?
作者: ilovejel    时间: 2013-3-27 16:18
千昭 发表于 2013-3-27 15:50
有没有范例工程?

http://pan.baidu.com/share/link?shareid=396247&uk=3675150025

感谢大手关注,这是工程,我由200多M压缩到了12M了
作者: 千昭    时间: 2013-3-27 22:00
本帖最后由 千昭 于 2013-3-27 22:26 编辑

还不是很完善,
有一点点的小问题,防御后的技能图标不消失

1.这是效果图


2.这是“窗口”位置对换(实际这只是两个填充颜色的区域)


3.这是那个红色“ACT” 和 攻击技能图标的设置


这是防御图标的位置



4.注释了第一条后 选择的时候就不消失了


5.这是名字的位置



注释保留了原来的设置
按照片修改就会达到效果

刚才第一次编辑有点小错误  已经更正
作者: ilovejel    时间: 2013-3-27 22:08
非常感谢啊,原来要调整这几个啊,我只调整了1个脚本,怪不得调不好,真是帮大忙了,学到了
作者: 千昭    时间: 2013-3-27 22:29
真正是改完了

防御图标不消失的问题  暂时不搞了  也没在你的要求范围内{:2_285:}





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