Project1

标题: 可不可以让出售物品不分类 [打印本页]

作者: PIKA~    时间: 2016-12-31 13:31
标题: 可不可以让出售物品不分类
就是出售时跟购买时一样,是不分类的
作者: 魔法丶小肉包    时间: 2017-1-1 22:42
RUBY 代码复制
  1. class Scene_Shop < Scene_MenuBase
  2.   def create_command_window
  3.     @command_window = Window_ShopCommand.new(@gold_window.x, @purchase_only)
  4.     @command_window.viewport = @viewport
  5.     @command_window.y = @help_window.height
  6.     @command_window.set_handler(:buy,    method(:command_buy))
  7.     @command_window.set_handler(:sell,   method(:on_category_ok))
  8.     @command_window.set_handler(:cancel, method(:return_scene))
  9.   end
  10.   def create_sell_window
  11.     wy = @category_window.y
  12.     wh = Graphics.height - wy
  13.     @sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh)
  14.     @sell_window.viewport = @viewport
  15.     @sell_window.help_window = @help_window
  16.     @sell_window.hide
  17.     @sell_window.set_handler(:ok,     method(:on_sell_ok))
  18.     @sell_window.set_handler(:cancel, method(:on_category_cancel))
  19.     @category_window.item_window = @sell_window
  20.   end
  21.   def create_category_window
  22.     @category_window = Window_ItemCategory.new
  23.     @category_window.viewport = @viewport
  24.     @category_window.help_window = @help_window
  25.     @category_window.y = @dummy_window.y
  26.     @category_window.hide.deactivate
  27.     @category_window.set_handler(:ok,     method(:on_category_ok))
  28.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  29.     @category_window.height = 0
  30.   end
  31.   def on_category_ok
  32.     activate_sell_window
  33.     @dummy_window.hide
  34.     @sell_window.select(0)
  35.   end
  36. end
  37. class Window_ShopSell < Window_ItemList
  38.   def include?(item)
  39.     case @category
  40.     when :item
  41.       item.is_a?(RPG::Item) && !item.key_item? or item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor) or item.is_a?(RPG::Item) && item.key_item?
  42.     else
  43.       false
  44.     end
  45.   end
  46. end





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1