Project1

标题: 怎么缩短两行物品之间的行间距? [打印本页]

作者: 海的那边    时间: 2009-7-7 08:32
标题: 怎么缩短两行物品之间的行间距?
就是这么个意思:我把物品的字号调小了,但是物品间的行间距还是这么大,看起来怪别扭的,有什么方法调下两行之间的行间距。
嗯,就这样了,谢谢。。
作者: 紫苏    时间: 2009-7-7 10:14
  1. class Window_Item
  2.   #--------------------------------------------------------------------------
  3.   # ● 更新光标矩形
  4.   #--------------------------------------------------------------------------
  5.   def update_cursor_rect
  6.     # 光标位置不满 0 的情况下
  7.     if @index < 0
  8.       self.cursor_rect.empty
  9.       return
  10.     end
  11.     # 获取当前的行
  12.     row = @index / @column_max
  13.     # 当前行被显示开头行前面的情况下
  14.     if row < self.top_row
  15.       # 从当前行向开头行滚动
  16.       self.top_row = row
  17.     end
  18.     # 当前行被显示末尾行之后的情况下
  19.     if row > self.top_row + (self.page_row_max - 1)
  20.       # 从当前行向末尾滚动
  21.       self.top_row = row - (self.page_row_max - 1)
  22.     end
  23.     # 计算光标的宽度
  24.     cursor_width = self.width / @column_max - 32
  25.     # 计算光标坐标
  26.     x = @index % @column_max * (cursor_width + 32)
  27.     y = @index / @column_max * 24 - self.oy
  28.     # 更新光标矩形
  29.     self.cursor_rect.set(x, y, cursor_width, 24)
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 描绘项目
  33.   #     index : 项目编号
  34.   #--------------------------------------------------------------------------
  35.   def draw_item(index)
  36.     item = @data[index]
  37.     case item
  38.     when RPG::Item
  39.       number = $game_party.item_number(item.id)
  40.     when RPG::Weapon
  41.       number = $game_party.weapon_number(item.id)
  42.     when RPG::Armor
  43.       number = $game_party.armor_number(item.id)
  44.     end
  45.     if item.is_a?(RPG::Item) and
  46.        $game_party.item_can_use?(item.id)
  47.       self.contents.font.color = normal_color
  48.     else
  49.       self.contents.font.color = disabled_color
  50.     end
  51.     x = 4 + index % 2 * (288 + 32)
  52.     y = index / 2 * 22
  53.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  54.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  55.     bitmap = RPG::Cache.icon(item.icon_name)
  56.     opacity = self.contents.font.color == normal_color ? 255 : 128
  57.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  58.     self.contents.draw_text(x + 28, y, 212, 22, item.name, 0)
  59.     self.contents.draw_text(x + 240, y, 16, 22, ":", 1)
  60.     self.contents.draw_text(x + 256, y, 24, 22, number.to_s, 2)
  61.   end
  62. end
复制代码
调节前一段的红色部分数值是修改光标矩形的高度:
    y = @index / @column_max * 24 - self.oy
    # 更新光标矩形
    self.cursor_rect.set(x, y, cursor_width, 24)

update_cursor_rect 方法是 Window_Item 的基类中的一个方法,这里是方法的覆盖;

而调节第二段的红色部分则是修改两行文字的间距了:
y = index / 2 * 22
作者: 我不宅    时间: 2009-7-7 11:23
谢谢~~同求~~~
作者: 海的那边    时间: 2009-7-7 12:56
行了,谢谢。。:handshake
作者: 飞天猪猪    时间: 2009-7-7 13:54
提示: 作者被禁止或删除 内容自动屏蔽




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