赞 | 5 |
VIP | 0 |
好人卡 | 0 |
积分 | 11 |
经验 | 11099 |
最后登录 | 2024-9-19 |
在线时间 | 324 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1090
- 在线时间
- 324 小时
- 注册时间
- 2017-1-24
- 帖子
- 122
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 戴迪 于 2017-2-19 00:54 编辑
自己调了装备界面item的列数,改成5行,然后在最后添加了一个移动光标矩形的间距,但是好像不能换行阿- -#============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # 装备画面、显示浏览变更装备的候补物品的窗口。 #============================================================================== class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 # equip_type : 装备部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) super(160, 256, 640, 224) @actor = actor @equip_type = equip_type @column_max = 5 refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● 获取物品 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # 添加可以装备的武器 if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end # 添加可以装备的防具 if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end # 添加空白 @data.push(nil) # 生成位图、描绘全部项目 @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max-1 draw_item(i) end end #-------------------------------------------------------------------------- # ● 项目的描绘 # index : 项目符号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] x = 4 + index % 5 * (32) y = index / 5 * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color # self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) # self.contents.draw_text(x +32 , y, 16, 32, ":", 1) self.contents.draw_text(x , y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(@index * 32,0 , 32, 32) end end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(160, 256, 640, 224)
@actor = actor
@equip_type = equip_type
@column_max = 5
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以装备的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# 添加可以装备的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 添加空白
@data.push(nil)
# 生成位图、描绘全部项目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 5 * (32)
y = index / 5 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
# self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# self.contents.draw_text(x +32 , y, 16, 32, ":", 1)
self.contents.draw_text(x , y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(@index * 32,0 , 32, 32)
end
end
==============(第一次更新)===================================
后来自己又弄了下,成了这样,不知道怎么弄才能把光标移动到第25个装备上时.就不能再往下移动!不然多出来一个位置不美观
#============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # 装备画面、显示浏览变更装备的候补物品的窗口。 #============================================================================== class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 # equip_type : 装备部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) super(160, 256, 640, 224) @actor = actor @equip_type = equip_type @column_max = 5 refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● 获取物品 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # 添加可以装备的武器 if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...50 if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end # 添加可以装备的防具 if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end # 添加空白 @data.push(nil) # 生成位图、描绘全部项目 @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max-1 draw_item(i) end end #-------------------------------------------------------------------------- # ● 项目的描绘 # index : 项目符号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] x = 4 + index % 5 * (32) y = index / 5 * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color # self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) # self.contents.draw_text(x +32 , y, 16, 32, ":", 1) self.contents.draw_text(x , y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(@index * 32,0 , 32, 32) if @index > 4 self.cursor_rect.set( (@index - 5 )* 32,32 , 32, 32) end if @index > 9 self.cursor_rect.set( (@index - 10 )* 32,64 , 32, 32) end if @index > 14 self.cursor_rect.set( (@index - 15 )* 32,96 , 32, 32) end if @index > 19 self.cursor_rect.set( (@index - 20 )* 32,128 , 32, 32) end end end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(160, 256, 640, 224)
@actor = actor
@equip_type = equip_type
@column_max = 5
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以装备的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...50
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# 添加可以装备的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 添加空白
@data.push(nil)
# 生成位图、描绘全部项目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 5 * (32)
y = index / 5 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
# self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# self.contents.draw_text(x +32 , y, 16, 32, ":", 1)
self.contents.draw_text(x , y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(@index * 32,0 , 32, 32)
if @index > 4
self.cursor_rect.set( (@index - 5 )* 32,32 , 32, 32)
end
if @index > 9
self.cursor_rect.set( (@index - 10 )* 32,64 , 32, 32)
end
if @index > 14
self.cursor_rect.set( (@index - 15 )* 32,96 , 32, 32)
end
if @index > 19
self.cursor_rect.set( (@index - 20 )* 32,128 , 32, 32)
end
end
end
|
|