查看: 3098|回复: 1

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

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

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

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

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

123

123


  1. #==============================================================================
  2. # ■ Window_EquipStatus
  3. #------------------------------------------------------------------------------
  4. #  装備画面で、アクターの能力値変化を表示するウィンドウです。
  5. #==============================================================================

  6. class Window_EquipStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(x, y)
  11.     super(x, y, 250, 300)
  12.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  13.     @temp_actor = nil
  14.     refresh
  15.    
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● ウィンドウ幅の取得
  19.   #--------------------------------------------------------------------------
  20.   def window_width
  21.     return 250
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● ウィンドウ高さの取得
  25.   #--------------------------------------------------------------------------
  26.   def window_height
  27.     fitting_height(visible_line_number)
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 表示行数の取得
  31.   #--------------------------------------------------------------------------
  32.   def visible_line_number
  33.     return 12
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● アクターの設定
  37.   #--------------------------------------------------------------------------
  38.   def actor=(actor)
  39.     return if @actor == actor
  40.     @actor = actor
  41.     refresh
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● リフレッシュ 定义状态栏显示项目
  45.   #--------------------------------------------------------------------------
  46.   def refresh
  47.     contents.clear
  48.     return unless @actor
  49.     @actor_sprite = Sprite.new      #定义角色头像
  50.    
  51.     @actor_sprite.bitmap = Cache.system(@actor.name)  #定义角色头像路径system下
  52.     @actor_sprite.opacity = 255      #定义角色头像 不透明
  53.    
  54.     #draw_actor_face(@actor, 0, 0)
  55.     #draw_actor_hp(@actor, 50, 0, width = 75)
  56.     #draw_actor_mp(@actor, 130, 0, width = 75)
  57.     #draw_actor_level(@actor, 100, 0)
  58.     draw_actor_name(@actor, 0, 0) if @actor
  59.    
  60.     draw_xparam_name(x + 4, y)
  61.     draw_current_xparam(x + 94, y) if @actor
  62.     draw_right_arrow_2(x + 126, y)
  63.     draw_new_xparam(x + 150, y) if @temp_actor
  64.    
  65.     8.times {|i| draw_item(0, line_height * (1 + i), i) }
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 装備変更後の一時アクター設定
  69.   #--------------------------------------------------------------------------
  70.   def set_temp_actor(temp_actor)
  71.     return if @temp_actor == temp_actor
  72.     @temp_actor = temp_actor
  73.     refresh
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 項目の描画
  77.   #--------------------------------------------------------------------------
  78.   def draw_item(x, y, param_id)
  79.     #draw_actor_face(@actor, 0, 0)
  80.     draw_param_name(x + 4, y, param_id)
  81.     draw_current_param(x + 94, y, param_id) if @actor  #94
  82.     draw_right_arrow(x + 126, y)   #126
  83.     draw_new_param(x + 150, y, param_id) if @temp_actor
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 能力値の名前を描画
  87.   #--------------------------------------------------------------------------
  88.   def draw_param_name(x, y, param_id)
  89.     change_color(system_color)
  90.     draw_text(x, y, 80, line_height, Vocab::param(param_id))
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 現在の能力値を描画
  94.   #--------------------------------------------------------------------------
  95.   def draw_current_param(x, y, param_id)
  96.     change_color(normal_color)
  97.     draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 右向き矢印を描画
  101.   #--------------------------------------------------------------------------
  102.   def draw_right_arrow(x, y)
  103.     change_color(system_color)
  104.     draw_text(x, y, 22, line_height, "→", 1)
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 装備変更後の能力値を描画
  108.   #--------------------------------------------------------------------------
  109.   def draw_new_param(x, y, param_id)
  110.     new_value = @temp_actor.param(param_id)
  111.     change_color(param_change_color(new_value - @actor.param(param_id)))
  112.     draw_text(x, y, 32, line_height, new_value, 2)
  113.   end
  114.    #--------------------------------------------------------------------------
  115.   # ● 绘制额外能力值的名字
  116.   #--------------------------------------------------------------------------
  117.   def draw_xparam_name(x, y)
  118.     change_color(system_color)
  119.     self.contents.font.size = 20
  120.     draw_text(x, y + line_height * 9, 80, line_height, "命中率")
  121.     draw_text(x, y + line_height * 10 , 80, line_height, "回避率")
  122.     draw_text(x, y + line_height * 11 , 80, line_height, "必杀率")
  123.     #self.contents.font.size = 18
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 绘制额外当前能力值
  127.   #--------------------------------------------------------------------------
  128.   def draw_current_xparam(x, y)
  129.     change_color(normal_color)
  130.     self.contents.font.size = 20
  131.     hit = @actor.xparam(0) * 100
  132.     eva = @actor.xparam(1) * 100
  133.     cri = @actor.xparam(2) * 100
  134.     draw_text(x, y + line_height * 9, 32, line_height, hit.round)
  135.     draw_text(x, y + line_height * 10, 32, line_height, eva.round)
  136.     draw_text(x, y + line_height * 11, 32, line_height, cri.round)
  137.    
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 绘制额外右方向箭头
  141.   #--------------------------------------------------------------------------
  142.   def draw_right_arrow_2(x, y)
  143.     change_color(system_color)
  144.     draw_text(x, y + line_height * 9, 22, line_height, "→", 1)
  145.     draw_text(x, y + line_height * 10, 22, line_height, "→", 1)
  146.     draw_text(x, y + line_height * 11, 22, line_height, "→", 1)
  147.     self.contents.font.size = 20
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 绘制更换装备后的额外能力值
  151.   #--------------------------------------------------------------------------
  152.   def draw_new_xparam(x, y)
  153.     new_hit = @temp_actor.xparam(0) * 100
  154.     change_color(param_change_color(new_hit - @actor.xparam(0)*100))
  155.     draw_text(x, y+ line_height * 9, 32, line_height, new_hit.round, 2)
  156.     new_eva = @temp_actor.xparam(1) * 100
  157.     change_color(param_change_color(new_eva - @actor.xparam(1)*100))
  158.     draw_text(x, y+ line_height * 10, 32, line_height, new_eva.round, 2)
  159.     new_cri = @temp_actor.xparam(2) * 100
  160.     change_color(param_change_color(new_cri - @actor.xparam(2)*100))
  161.     draw_text(x, y+ line_height * 11, 32, line_height, new_cri.round, 2)
  162.     self.contents.font.size = 20
  163.   end
  164. end
复制代码


求帮助,谢谢~!
梦石
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.

在本版发帖返回顶部