查看: 3070|回复: 1

[已经解决] 如何让装备界面这个文字对齐

[复制链接]
梦石
0
星屑
50
在线时间
49 小时
注册时间
2013-5-23
回帖
8
发表于 2013-6-9 19:42:20 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 skgame 于 2013-6-9 21:23 编辑

123

123


[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_EquipStatus
#------------------------------------------------------------------------------
#  装備画面で、アクターの能力値変化を表示するウィンドウです。
#==============================================================================

class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 250, 300)
    @actor = nil
    @temp_actor = nil
    refresh
   
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return 250
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ高さの取得
  #--------------------------------------------------------------------------
  def window_height
    fitting_height(visible_line_number)
  end
  #--------------------------------------------------------------------------
  # ● 表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    return 12
  end
  #--------------------------------------------------------------------------
  # ● アクターの設定
  #--------------------------------------------------------------------------
  def actor=(actor)
    return if @actor == actor
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ 定义状态栏显示项目
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    return unless @actor
    @actor_sprite = Sprite.new      #定义角色头像
   
    @actor_sprite.bitmap = Cache.system(@actor.name)  #定义角色头像路径system下
    @actor_sprite.opacity = 255      #定义角色头像 不透明
   
    #draw_actor_face(@actor, 0, 0)
    #draw_actor_hp(@actor, 50, 0, width = 75)
    #draw_actor_mp(@actor, 130, 0, width = 75)
    #draw_actor_level(@actor, 100, 0)
    draw_actor_name(@actor, 0, 0) if @actor
   
    draw_xparam_name(x + 4, y)
    draw_current_xparam(x + 94, y) if @actor
    draw_right_arrow_2(x + 126, y)
    draw_new_xparam(x + 150, y) if @temp_actor
   
    8.times {|i| draw_item(0, line_height * (1 + i), i) }
  end
  #--------------------------------------------------------------------------
  # ● 装備変更後の一時アクター設定
  #--------------------------------------------------------------------------
  def set_temp_actor(temp_actor)
    return if @temp_actor == temp_actor
    @temp_actor = temp_actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(x, y, param_id)
    #draw_actor_face(@actor, 0, 0)
    draw_param_name(x + 4, y, param_id)
    draw_current_param(x + 94, y, param_id) if @actor  #94
    draw_right_arrow(x + 126, y)   #126
    draw_new_param(x + 150, y, param_id) if @temp_actor
  end
  #--------------------------------------------------------------------------
  # ● 能力値の名前を描画
  #--------------------------------------------------------------------------
  def draw_param_name(x, y, param_id)
    change_color(system_color)
    draw_text(x, y, 80, line_height, Vocab::param(param_id))
  end
  #--------------------------------------------------------------------------
  # ● 現在の能力値を描画
  #--------------------------------------------------------------------------
  def draw_current_param(x, y, param_id)
    change_color(normal_color)
    draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
  end
  #--------------------------------------------------------------------------
  # ● 右向き矢印を描画
  #--------------------------------------------------------------------------
  def draw_right_arrow(x, y)
    change_color(system_color)
    draw_text(x, y, 22, line_height, "→", 1)
  end
  #--------------------------------------------------------------------------
  # ● 装備変更後の能力値を描画
  #--------------------------------------------------------------------------
  def draw_new_param(x, y, param_id)
    new_value = @temp_actor.param(param_id)
    change_color(param_change_color(new_value - @actor.param(param_id)))
    draw_text(x, y, 32, line_height, new_value, 2)
  end
   #--------------------------------------------------------------------------
  # ● 绘制额外能力值的名字
  #--------------------------------------------------------------------------
  def draw_xparam_name(x, y)
    change_color(system_color)
    self.contents.font.size = 20
    draw_text(x, y + line_height * 9, 80, line_height, "命中率")
    draw_text(x, y + line_height * 10 , 80, line_height, "回避率")
    draw_text(x, y + line_height * 11 , 80, line_height, "必杀率")
    #self.contents.font.size = 18
  end
  #--------------------------------------------------------------------------
  # ● 绘制额外当前能力值
  #--------------------------------------------------------------------------
  def draw_current_xparam(x, y)
    change_color(normal_color)
    self.contents.font.size = 20
    hit = @actor.xparam(0) * 100
    eva = @actor.xparam(1) * 100
    cri = @actor.xparam(2) * 100
    draw_text(x, y + line_height * 9, 32, line_height, hit.round)
    draw_text(x, y + line_height * 10, 32, line_height, eva.round)
    draw_text(x, y + line_height * 11, 32, line_height, cri.round)
   
  end
  #--------------------------------------------------------------------------
  # ● 绘制额外右方向箭头
  #--------------------------------------------------------------------------
  def draw_right_arrow_2(x, y)
    change_color(system_color)
    draw_text(x, y + line_height * 9, 22, line_height, "→", 1)
    draw_text(x, y + line_height * 10, 22, line_height, "→", 1)
    draw_text(x, y + line_height * 11, 22, line_height, "→", 1)
    self.contents.font.size = 20
  end
  #--------------------------------------------------------------------------
  # ● 绘制更换装备后的额外能力值
  #--------------------------------------------------------------------------
  def draw_new_xparam(x, y)
    new_hit = @temp_actor.xparam(0) * 100
    change_color(param_change_color(new_hit - @actor.xparam(0)*100))
    draw_text(x, y+ line_height * 9, 32, line_height, new_hit.round, 2)
    new_eva = @temp_actor.xparam(1) * 100
    change_color(param_change_color(new_eva - @actor.xparam(1)*100))
    draw_text(x, y+ line_height * 10, 32, line_height, new_eva.round, 2)
    new_cri = @temp_actor.xparam(2) * 100
    change_color(param_change_color(new_cri - @actor.xparam(2)*100))
    draw_text(x, y+ line_height * 11, 32, line_height, new_cri.round, 2)
    self.contents.font.size = 20
  end
end
[/pre]

求帮助,谢谢~!
梦石
0
星屑
50
在线时间
84 小时
注册时间
2013-4-5
回帖
138
发表于 2013-6-9 20:51:05 | 显示全部楼层
把131行 20 改成 19 试试 多出12个像素 应该刚刚好

点评

谢谢,已经解决了~~,直接调用自定义参数是可以改的,默认的改不了。。  发表于 2013-6-9 21:23

评分

参与人数 1星屑 +100 收起 理由
Sion + 100 感谢帮忙

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部