赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 18354 |
最后登录 | 2016-7-19 |
在线时间 | 9 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 9 小时
- 注册时间
- 2007-12-15
- 帖子
- 244
|
9楼

楼主 |
发表于 2008-4-17 02:24:18
|
只看该作者
- #==============================================================================
- # ■ Window_Equip
- #------------------------------------------------------------------------------
- # 装备物品大图标显示。
- #==============================================================================
- class Window_Equip < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(145, 402, 200, 200)
- @item = nil
- @item_id = -1
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if @item != nil
- if @item != @item_id
- self.contents.clear
- bitmap = Bitmap.new("Graphics/system/menu/Item/" + @item.name + ".png")
- pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap, pic_rect)
- @item_id = @item
- end
- else
- @item_id = nil
- self.contents.clear
- bitmap = Bitmap.new("Graphics/system/menu/Item/空.png")
- pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap, pic_rect)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- #--------------------------------------------------------------------------
- def set_item(item)
- @item = item
- end
- #--------------------------------------------------------------------------
- # ● 规位
- #--------------------------------------------------------------------------
- def set_item_id
- @item_id = nil
- end
- end
复制代码- #==============================================================================
- # ■ Window_Item_New
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item_New < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(160, 64, 480, 352)
- @column_max = 2
- refresh
- self.index = 0
- 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 = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (self.width / 2)
- y = index / 2 * 32
- 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)
- self.contents.draw_text(x + self.width / @column_max - 72, y, 16, 32, ":", 1)
- self.contents.draw_text(x + self.width / @column_max - 64, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
复制代码- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 特技及物品的说明、角色的状态显示的窗口。
- #==============================================================================
- class Window_Help_New < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(137, 480 - 96, 520,128)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.z = 9999
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- # 如果文本和对齐方式的至少一方与上次的不同
- if text != @text or align != @align
- # 再描绘文本
- self.opacity = 0
- self.contents.clear
- self.contents.font.color.set(0,0,0)
- src_rect = Rect.new(0, 0, 560, 128)
- back_help = Bitmap.new("Graphics/system/menu/back/menu_back_help.png")
- self.contents.blt(-45, 0, back_help, src_rect, 255)
- self.contents.draw_text(112, 0, 8 * 48, 96, text, align)
- @text = text
- @align = align
- @actor = nil
- end
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 设置角色
- # actor : 要显示状态的角色
- #--------------------------------------------------------------------------
- def set_actor(actor)
- if actor != @actor
- self.contents.clear
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置敌人
- # enemy : 要显示名字和状态的敌人
- #--------------------------------------------------------------------------
- def set_enemy(enemy)
- text = enemy.name
- state_text = make_battler_state_text(enemy, 112, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- end
- end
复制代码
应该就是上面三个了吧
第一个是Window_Equip_Icon
第二个是Window_Item New!
第三个是Window_Help New! |
|