Project1
标题:
物品排列怎么弄?
[打印本页]
作者:
倚天
时间:
2008-12-11 01:48
提示:
作者被禁止或删除 内容自动屏蔽
作者:
clap_pl
时间:
2008-12-11 06:08
什么叫物品排列 你想怎么排列
- - 真是的 说清楚点好不
作者:
倚天
时间:
2008-12-11 18:06
提示:
作者被禁止或删除 内容自动屏蔽
作者:
『华仔』
时间:
2008-12-11 18:36
提示:
作者被禁止或删除 内容自动屏蔽
作者:
clap_pl
时间:
2008-12-11 18:41
在原来的脚本基础上改一下
在window_item 这一项里面的
def draw_item(index)下面有一句
x = 4 + index % 6 * (288 + 32)
改成
w = self.width/6
x = 4 + index % 6 * w
再把后面有一句
self.contents.draw_text(x + 6, y, 12, 22, number.to_s, 2)
改成
self.contents.draw_text(x + 32, y, 32, 22, number.to_s, 2)
就可以了 效果如下:
作者:
倚天
时间:
2008-12-11 18:42
提示:
作者被禁止或删除 内容自动屏蔽
作者:
clap_pl
时间:
2008-12-11 18:44
我节图里 不是一行6个吗
本来也就不难...
不玩网游 所以你说大话什么的我也不知道什么样子
作者:
倚天
时间:
2008-12-11 18:52
提示:
作者被禁止或删除 内容自动屏蔽
作者:
clap_pl
时间:
2008-12-11 22:55
又改了下 改成100X100的图标
每行6个 向下无限延伸
大体就是如此了 再来 LZ自己研究下 就可以改成你想要的任何样子了
效果如图
替换掉原来的 WINDOW_ITEM那项
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# 物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 6
refresh
self.index = 0
# 战斗中的情况下将窗口移至中央并将其半透明化
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加报务
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# 在战斗中以外添加武器、防具
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 100)
for i in 0...@item_max
draw_item(i)
end
end
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
w = 100
x = index % 6 * w#(288 + 32)
y = index / 6 *w#32
rect = Rect.new(x, y, self.width / @column_max - 32, w)
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 , bitmap, Rect.new(0, 0, bitmap.width, bitmap.height), 150)
# self.contents.draw_text(x + 140, y, 16, 32, ":", 1)
self.contents.draw_text(x , y+40, 90, 90, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
def top_row
# 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
return self.oy / 100
end
#--------------------------------------------------------------------------
# ● 设置开头行
# row : 显示开头的行
#--------------------------------------------------------------------------
def top_row=(row)
# row 未满 0 的场合更正为 0
if row < 0
row = 0
end
# row 超过 row_max - 1 的情况下更正为 row_max - 1
if row > row_max - 1
row = row_max - 1
end
# row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
self.oy = row * 100
end
#--------------------------------------------------------------------------
# ● 获取 1 页可以显示的行数
#--------------------------------------------------------------------------
def page_row_max
# 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
return (self.height - 32) / 100
end
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 % 6 * 100
y = @index / @column_max * 100 - self.oy
# 更新国标矩形
# w = 100
# x = 10 + @index % 6 * w#(288 + 32)
# y = @index / 6 *w#32
self.cursor_rect.set(x, y, 100, 100)
end
def update
super
end
end
复制代码
[LINE]1,#dddddd[/LINE]
版主对此帖的认可:『完成的很好。』,积分『+200』。
作者:
莱恩哈特
时间:
2008-12-12 10:07
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1