| 赞 | 289 |
| VIP | |
| 好人卡 | |
| 积分 | 85 |
| 经验 | |
| 最后登录 | 2019-7-14 |
| 在线时间 | 775 小时 |
- 梦石
- 0
- 星屑
- 8498
- 在线时间
- 775 小时
- 注册时间
- 2017-11-10
- 回帖
- 1074
|
楼主 |
发表于 2018-1-22 21:55:51
|
显示全部楼层
瞎改的,不起效果,还是哪里弄错了...
- #encoding:utf-8
- #==============================================================================
- # ■ Window_ItemList
- #------------------------------------------------------------------------------
- # 物品画面中,显示持有物品的窗口。
- #==============================================================================
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @category = :none
- @data = []
- ###
- @help1_window = Window_Base.new(80, 168, 400, 64)
- string = "該物品使用的時機不對哦。"
- @help1_window.draw_text(4, 0, 368, 32, string,1)
- @help1_window.hide
- @help1_window.z = 9999
- @help1_window.opacity = 192
- ###
- end
- #--------------------------------------------------------------------------
- # ● 设置分类
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # ● 获取项目数
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # ● 获取选择项目的有效状态
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # ● 查询列表中是否含有此物品
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(RPG::Item) && !item.key_item?
- when :weapon
- item.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(RPG::Armor)
- when :key_item
- item.is_a?(RPG::Item) && item.key_item?
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # ● 查询此物品是否可用
- #--------------------------------------------------------------------------
- def enable?(item)
- $game_party.usable?(item)
- end
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_party.all_items.select {|item| include?(item) }
- @data.push(nil) if include?(nil)
- end
- #--------------------------------------------------------------------------
- # ● 返回上一个选择的位置
- #--------------------------------------------------------------------------
- def select_last
- select(@data.index($game_party.last_item.object) || 0)
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- draw_item_number(rect, item)
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制物品个数
- #--------------------------------------------------------------------------
- def draw_item_number(rect, item)
- draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- if Sound.play_buzzer
- @help1_window.show
- 30.times{Graphics.update}
- @help1_window.hide
- end
- end
- end
复制代码 |
|