赞 | 32 |
VIP | 146 |
好人卡 | 11 |
积分 | 38 |
经验 | 143619 |
最后登录 | 2024-6-29 |
在线时间 | 1966 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3846
- 在线时间
- 1966 小时
- 注册时间
- 2013-1-3
- 帖子
- 9536
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 紫英晓狼1130 于 2015-7-5 13:36 编辑
物品数量在改变后会重叠,如图
在下认为Window_Item出了问题
求解决办法
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item < Window_Selectable
- attr_accessor :backsp2
- attr_accessor :help2
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(46, 173, 544, 250)
- #==============================
- self.windowskin = RPG::Cache.windowskin("choose")
- @backsp2 = Sprite.new
- @backsp2.bitmap = Bitmap.new("Graphics/System/物品.jpg")
- @backsp2.x = 46
- @backsp2.y = 183
- @backsp2.z = 101
- #=============================================================
- @help2 = Sprite.new
- @help2.bitmap = Bitmap.new("Graphics/System/帮助窗口使用.png")
- @help2.x = 46
- @help2.y = 49
- @help2.z = 100
- #==============================
- @column_max = 3
- refresh
- self.index = 0
- # 战斗中的情况下将窗口移至中央并将其半透明化
- if $game_temp.in_battle
- self.y = 173
- self.height = 240
- self.back_opacity = 255
- 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 * 32)
- 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 = Color.new(66,121,8,255)
- self.contents.font.size = 18
- else
- self.contents.font.color = Color.new(99,97,99,255)
- self.contents.font.size = 18
- end
- x = index % 3 * 174 - 13
- y = index / 3 * 26
- rect = Rect.new(x + 5, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.draw_text(x + 13, y, 204, 32, item.name, 0)
- self.contents.draw_text(x + 122, y , 54, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- desc1 = self.item == nil ? '' : self.item.description
- item2 = $data_skills[self.item.id + 1]
- desc2 = item2 == nil ? '' : item2.description
- @help_window.set_text(desc1, [@index / @column_max * 28 - self.oy, 260].min)
- end
- #====================
- def dispose
- super
- @backsp2.dispose
- @help2.dispose
- end
- #=====================
- end
复制代码 |
评分
-
查看全部评分
|