Project1
标题:
怎么缩短两行物品之间的行间距?
[打印本页]
作者:
海的那边
时间:
2009-7-7 08:32
标题:
怎么缩短两行物品之间的行间距?
就是这么个意思:我把物品的字号调小了,但是物品间的行间距还是这么大,看起来怪别扭的,有什么方法调下两行之间的行间距。
嗯,就这样了,谢谢。。
作者:
紫苏
时间:
2009-7-7 10:14
class Window_Item
#--------------------------------------------------------------------------
# ● 更新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽度
cursor_width = self.width / @column_max - 32
# 计算光标坐标
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 24 - self.oy
# 更新光标矩形
self.cursor_rect.set(x, y, cursor_width, 24)
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 22
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 22, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 22, ":", 1)
self.contents.draw_text(x + 256, y, 24, 22, number.to_s, 2)
end
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