赞 | 0 |
VIP | 4 |
好人卡 | 4 |
积分 | 1 |
经验 | 21393 |
最后登录 | 2017-7-15 |
在线时间 | 586 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 52
- 在线时间
- 586 小时
- 注册时间
- 2012-5-31
- 帖子
- 768
|
本帖最后由 hys111111 于 2012-11-16 18:52 编辑
- class Window_ComposeUp < Window_Selectable
- attr_accessor :forge_item
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize(forge_item)
- super(180, 90, 130, 80)
- @column_max = 2
- @forge_item = []
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item_number
- return @data_number[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- @data_number = []
- @forge_item = $game_temp.forge
- for item_forge in @forge_item
- case item_forge[0]
- when 0
- item = $data_items[item_forge[1]]
- when 1
- item = $data_weapons[item_forge[1]]
- when 2
- item = $data_armors[item_forge[1]]
- end
- if (item != nil) and (item_forge[2] != 0)
- @data.push(item)
- @data_number.push(item_forge[2])
- else
- @data.delete(item)
- end
- end
- # 如果项目数不是 0 就生成位图、描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 55)
- 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_temp.forge[index][2]
- when RPG::Weapon
- number = $game_temp.forge[index][2]
- when RPG::Armor
- number = $game_temp.forge[index][2]
- end
- self.contents.font.color = normal_color
- x = 4 + index % @column_max * (60)
- y = 8
- 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 + 10, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 10, y - 15, 24, 32, number.to_s, 2)
- end
复制代码 如何让这窗口中只能放二个物品而且数量为1?
请教大大们
{:2_258:} |
|