赞 | 3 |
VIP | 0 |
好人卡 | 0 |
积分 | 14 |
经验 | 0 |
最后登录 | 2024-10-31 |
在线时间 | 179 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1360
- 在线时间
- 179 小时
- 注册时间
- 2019-10-4
- 帖子
- 257
|
5楼
楼主 |
发表于 2023-3-26 23:20:00
|
只看该作者
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- #self.windowskin = RPG::Cache.windowskin("skill")
- if $game_temp.in_battle == true#处于战斗中的话
- super(10, 128, 640+364,416+32)
- self.z=9999
- # 战斗中的情况下将窗口移至中央并将其半透明化
- #self.windowskin = RPG::Cache.windowskin("skill")
- @column_max = 2
- $game_switches[13] = true
- else
- super(0, 128-64, 640+384,416+32+64)
- @column_max = 2
- $game_switches[13] = false
- end
- refresh
- self.index = 0
- @help3 = Sprite.new
- @help3.bitmap = Bitmap.new("Graphics/Windowskins/BG-Z.png")
- @help3.y = -144
- @help3.z=9999
- if $game_temp.in_battle
- self.y = 64
- self.height = 255+99#高度设置
- self.opacity = $game_temp.test_opacity
- self.z=9999
- #self.back_opacity = $game_temp.test_opacity
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- @help3.dispose
- 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 = normal_color
- self.contents.font.size = 18
- else
- self.contents.font.color = disabled_color
- end
- if $game_switches[13] == true
- x = 4 + index %2 * (480 + 32)
- y = index / 2 * 32
- else
- x = 4 + index %2 * (480 + 32)
- y = index / 2* 32
- end
-
- 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, 32, item.name, 0)#物品名
-
- if $game_switches[13] == true
- self.contents.draw_text(x + 240+110, y, 16+110, 32, ":", 1)#“:”符号标
- self.contents.draw_text(x + 256+80, y, 24+80, 32, number.to_s, 2)#消耗数
- else
- self.contents.draw_text(x + 240+120, y, 16+120, 32, ":", 1)#“:”符号标
- self.contents.draw_text(x + 256+90, y, 24+90, 32, number.to_s, 2)#消耗数
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- #====================
- def dispose
- super
- if $game_switches[13] == true
- @help3.dispose
- end
- end
- #=====================
- end
- end
复制代码
唯一缺点就是,在选择敌人,或者选择己方单体,方框没有去掉 |
|