查看: 2350|回复: 2

[已经解决] 关于Window_Status中的参数actor

[复制链接]
梦石
0
星屑
1919
在线时间
404 小时
注册时间
2014-7-7
回帖
209

开拓者

发表于 2016-7-20 15:22:51 | 显示全部楼层 |阅读模式

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

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

×
  1. #------------------------------------------------------------------------------
  2. #  状态画面中,显示角色基本信息的窗口。
  3. #==============================================================================

  4. class Window_Status < Window_Selectable
  5.   #--------------------------------------------------------------------------
  6.   # ● 初始化对象
  7.   #--------------------------------------------------------------------------
  8.   def initialize(actor)
  9.     super(0, 0, Graphics.width, Graphics.height)
  10.     @actor = actor
  11.     refresh
  12.     self.opacity = 0
  13.     activate
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 获取窗口的宽度
  17.   #--------------------------------------------------------------------------
  18.   def window_width
  19.     Graphics.width - 160
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 获取窗口的高度
  23.   #--------------------------------------------------------------------------
  24.   def window_height
  25.     Graphics.height
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 设置角色
  29.   #--------------------------------------------------------------------------
  30.   def actor=(actor)
  31.     return if @actor == actor
  32.     @actor = actor
  33.     refresh
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新
  37.   #--------------------------------------------------------------------------
  38.   def refresh
  39.     contents.clear
  40.     draw_block1   (line_height * 0)
  41.     draw_horz_line(line_height * 1)
  42.     draw_block2   (line_height * 2)
  43.     draw_horz_line(line_height * 6)
  44.     draw_block3   (line_height * 7)
  45.     draw_horz_line(line_height * 13)
  46.     draw_block4   (line_height * 14)
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 绘制区域 1
  50.   #--------------------------------------------------------------------------
  51.   #def draw_block1(y)
  52.   #  draw_actor_name(@actor, 4, y)
  53.   #  draw_actor_class(@actor, 128, y)
  54.   #  draw_actor_nickname(@actor, 288, y)
  55.   #end
  56.   #--------------------------------------------------------------------------
  57.   # ● 绘制区域 2
  58.   #--------------------------------------------------------------------------
  59.   def draw_block2(y)
  60.     #draw_actor_face(@actor, 8, y)
  61.     draw_basic_info(255, y)
  62.     #draw_exp_info(304, y)
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 绘制区域 3
  66.   #--------------------------------------------------------------------------
  67.   def draw_block3(y)
  68.     draw_parameters(255, y)
  69.     draw_equipments(300, y)
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 绘制区域 4
  73.   #--------------------------------------------------------------------------
  74. # def draw_block4(y)
  75.   #  draw_description(4, y)
  76. # end
  77.   #--------------------------------------------------------------------------
  78.   # ● 绘制水平线
  79.   #--------------------------------------------------------------------------
  80.   #def draw_horz_line(y)
  81.   #  line_y = y + line_height / 2 - 1
  82.   #  contents.fill_rect(0, line_y, contents_width, 2, line_color)
  83. # end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取水平线的颜色
  86.   #--------------------------------------------------------------------------
  87.   #def line_color
  88.   #  color = normal_color
  89.   #  color.alpha = 48
  90.   #  color
  91.   #end
  92.   #--------------------------------------------------------------------------
  93.   # ● 绘制基本信息
  94.   #--------------------------------------------------------------------------
  95.   def draw_basic_info(x, y)
  96.     draw_actor_level(@actor, x, y + line_height * 0)
  97.     draw_actor_icons(@actor, x, y + line_height * 1)
  98.     draw_actor_hp(@actor, x, y + line_height * 2)
  99.     draw_actor_mp(@actor, x, y + line_height * 3)
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 绘制能力值
  103.   #--------------------------------------------------------------------------
  104.   def draw_parameters(x, y)
  105.     6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
  106.   end
  107. =begin  
  108.   #--------------------------------------------------------------------------
  109.   # ● 绘制经验值信息
  110.   #--------------------------------------------------------------------------
  111.   def draw_exp_info(x, y)
  112.     s1 = @actor.max_level? ? "-------" : @actor.exp
  113.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  114.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  115.     change_color(system_color)
  116.     draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  117.     draw_text(x, y + line_height * 2, 180, line_height, s_next)
  118.     change_color(normal_color)
  119.     draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  120.     draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  121.   end
  122. =end  
  123.   #--------------------------------------------------------------------------
  124.   # ● 绘制装备
  125.   #--------------------------------------------------------------------------
  126.   def draw_equipments(x, y)
  127.     @actor.equips.each_with_index do |item, i|
  128.       draw_item_name(item, x, y + line_height * i)
  129.     end
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 绘制说明
  133.   #--------------------------------------------------------------------------
  134. # def draw_description(x, y)
  135. #   draw_text_ex(x, y, @actor.description)
  136. # end
  137. end
复制代码

第八行的参数actor是要传递什么?角色的index?还是角色名?
cheap
梦石
0
星屑
87
在线时间
92 小时
注册时间
2013-8-16
回帖
12
发表于 2016-7-20 15:47:46 | 显示全部楼层
角色的对象,这个对象有ID、姓名等属性

点评

谢谢  发表于 2016-7-20 19:48
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部