赞 | 3 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 610
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
很简单的东西....
用法:
1. 在Graphics文件夹内创建 Icons 文件夹
2. 把图片放在 Icons 里面
3. 在物品的备注里面填写 [picture 文件名]
4. 自己调整大图窗口的座标,在52行
- module Cache
- def self.icon(filename)
- load_bitmap("Graphics/Icons/", filename)
- end
- end
- class Window_Pict < Window_Base
- def initialize(x=0, y=0, width=544, height=WLH+32)
- super(x, y, width, height)
- end
- def set_pict(pict, hue = 0)
- if pict != @pict or hue != @hue
- self.contents.clear
- bitmap = Cache.icon(pict)
- x = (self.contents.width - bitmap.width ) / 2
- y = (self.contents.height - bitmap.height) / 2
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(x, y, bitmap, rect)
- @pict = pict
- @hue = hue
- end
- end
- end
- class RPG::BaseItem
- def picture
- self.note.split(/[\r\n]+/).each { |line|
- if line =~ /\[picture (\w+)\]/
- return $1.nil? ? "" : $1
- end}
- end
- end
- class Window_Item < Window_Selectable
- attr_reader :pict_window # 圖片窗口
- def update_help
- @help_window.set_text(item == nil ? "" : item.description)
- if @pict_window != nil
- @pict_window.set_pict(item == nil ? "" : item.picture)
- end
- end
- def pict_window=(pict_window)
- @pict_window = pict_window
- call_update_help
- end
- end
- class Scene_Item < Scene_Base
- alias c_start start
- alias c_update update
- alias c_terminate terminate
- def start
- c_start
- # 自己调整座标和大小
- @pict_window = Window_Pict.new(32, 32, 240, 212)
- @pict_window.viewport = @viewport
- @item_window.pict_window = @pict_window
- end
- def update
- c_update
- @pict_window.update
- end
- def terminate
- c_terminate
- @pict_window.dispose
- end
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|