Project1

标题: 装备栏的状态显示问题 [打印本页]

作者: yxidws    时间: 2015-6-30 21:36
标题: 装备栏的状态显示问题
如何显示命中率,回避率等等呢?
作者: yl51379    时间: 2015-7-1 09:18
你如果使用  图书馆中的 升级自由加点脚本 就可以在加点页面中看到这些属性  

如果不想用到加点的功能  也可以参考这个脚本中的 所有属性显示的设置方法

这里是传送门https://rpg.blue/thread-295517-1-1.html
作者: 黄濑凉太    时间: 2015-7-1 10:15
  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, window_width, window_height)
  12.     @actor = nil
  13.     @temp_actor = nil
  14.     refresh
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 获取窗口的宽度
  18.   #--------------------------------------------------------------------------
  19.   def window_width
  20.     return 208
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 获取窗口的高度
  24.   #--------------------------------------------------------------------------
  25.   def window_height
  26.     fitting_height(visible_line_number)
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 获取显示行数
  30.   #--------------------------------------------------------------------------
  31.   def visible_line_number
  32.     return 12
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 设置角色
  36.   #--------------------------------------------------------------------------
  37.   def actor=(actor)
  38.     return if @actor == actor
  39.     @actor = actor
  40.     refresh
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 刷新
  44.   #--------------------------------------------------------------------------
  45.   def refresh
  46.     contents.clear
  47.     draw_actor_name(@actor, 4, 0) if @actor
  48.     8.times {|i| draw_item(0, line_height * (1 + i), i) }
  49.     draw_xparam_name(x + 4, y)
  50.     draw_current_xparam(x + 94, y) if @actor
  51.     draw_right_arrow_2(x + 126, y)
  52.     draw_new_xparam(x + 150, y) if @temp_actor
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 设置更换装备后的临时角色
  56.   #--------------------------------------------------------------------------
  57.   def set_temp_actor(temp_actor)
  58.     return if @temp_actor == temp_actor
  59.     @temp_actor = temp_actor
  60.     refresh
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 绘制项目
  64.   #--------------------------------------------------------------------------
  65.   def draw_item(x, y, param_id)
  66.     draw_param_name(x + 4, y, param_id)
  67.     draw_current_param(x + 94, y, param_id) if @actor
  68.     draw_right_arrow(x + 126, y)
  69.     draw_new_param(x + 150, y, param_id) if @temp_actor
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 绘制能力值的名字
  73.   #--------------------------------------------------------------------------
  74.   def draw_param_name(x, y, param_id)
  75.     change_color(system_color)
  76.     draw_text(x, y, 80, line_height, Vocab::param(param_id))
  77.   end
  78.   
  79.   #--------------------------------------------------------------------------
  80.   # ● 绘制当前能力值
  81.   #--------------------------------------------------------------------------
  82.   def draw_current_param(x, y, param_id)
  83.     change_color(normal_color)
  84.     draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
  85.   end
  86.   
  87.   #--------------------------------------------------------------------------
  88.   # ● 绘制右方向箭头
  89.   #--------------------------------------------------------------------------
  90.   def draw_right_arrow(x, y)
  91.     change_color(system_color)
  92.     draw_text(x, y, 22, line_height, "→", 1)
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 绘制更换装备后的能力值
  96.   #--------------------------------------------------------------------------
  97.   def draw_new_param(x, y, param_id)
  98.     new_value = @temp_actor.param(param_id)
  99.     change_color(param_change_color(new_value - @actor.param(param_id)))
  100.     draw_text(x, y, 32, line_height, new_value, 2)
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 绘制额外能力值的名字
  104.   #--------------------------------------------------------------------------
  105.   def draw_xparam_name(x, y)
  106.     change_color(system_color)
  107.     draw_text(x, y + line_height * 6, 80, line_height, "命中率")
  108.     draw_text(x, y + line_height * 7 , 80, line_height, "回避率")
  109.     draw_text(x, y + line_height * 8 , 80, line_height, "必杀率")
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 绘制额外当前能力值
  113.   #--------------------------------------------------------------------------
  114.   def draw_current_xparam(x, y)
  115.     change_color(normal_color)
  116.     hit = @actor.xparam(0) * 100
  117.     eva = @actor.xparam(1) * 100
  118.     cri = @actor.xparam(2) * 100
  119.     draw_text(x, y + line_height * 6, 32, line_height, hit.round)
  120.     draw_text(x, y + line_height * 7, 32, line_height, eva.round)
  121.     draw_text(x, y + line_height * 8, 32, line_height, cri.round)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 绘制额外右方向箭头
  125.   #--------------------------------------------------------------------------
  126.   def draw_right_arrow_2(x, y)
  127.     change_color(system_color)
  128.     draw_text(x, y + line_height * 6, 22, line_height, "→", 1)
  129.     draw_text(x, y + line_height * 7, 22, line_height, "→", 1)
  130.     draw_text(x, y + line_height * 8, 22, line_height, "→", 1)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 绘制更换装备后的额外能力值
  134.   #--------------------------------------------------------------------------
  135.   def draw_new_xparam(x, y)
  136.     new_hit = @temp_actor.xparam(0) * 100
  137.     change_color(param_change_color(new_hit - @actor.xparam(0)*100))
  138.     draw_text(x, y+ line_height * 6, 32, line_height, new_hit.round, 2)
  139.     new_eva = @temp_actor.xparam(1) * 100
  140.     change_color(param_change_color(new_eva - @actor.xparam(1)*100))
  141.     draw_text(x, y+ line_height * 7, 32, line_height, new_eva.round, 2)
  142.     new_cri = @temp_actor.xparam(2) * 100
  143.     change_color(param_change_color(new_cri - @actor.xparam(2)*100))
  144.     draw_text(x, y+ line_height * 8, 32, line_height, new_cri.round, 2)
  145.   end
  146. end
复制代码
坐标窗口大小什么的自己改吧




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