Project1

标题: 收藏品脚本 [打印本页]

作者: 小小西    时间: 2020-2-23 17:52
标题: 收藏品脚本
这个脚本在菜单界面可以直接打开贵重物品界面,但不能使用里面的物品,怎么改能使用里面的物品。
RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● [追加]贵重物品指令在菜单中显示的名称
  3.   #--------------------------------------------------------------------------
  4.   def Vocab.collection
  5.     "收藏品"
  6.   end
  7.  
  8. class Window_MenuCommand
  9.   #--------------------------------------------------------------------------
  10.   # ● [别名修改]独自添加指令用
  11.   #--------------------------------------------------------------------------
  12.   alias add_original_commands_for_collection add_original_commands
  13.   def add_original_commands
  14.     add_original_commands_for_collection
  15.     add_command(Vocab::collection, :collection)
  16.   end
  17. end
  18.  
  19. class Scene_Menu < Scene_MenuBase
  20.   #--------------------------------------------------------------------------
  21.   # ● [别名修改]生成指令窗口
  22.   #--------------------------------------------------------------------------
  23.   alias create_command_window_for_collection create_command_window
  24.   def create_command_window
  25.     create_command_window_for_collection
  26.     @command_window.set_handler(:collection, method(:call_scene_collection))
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● [追加]呼叫贵重物品界面
  30.   #--------------------------------------------------------------------------
  31.   def call_scene_collection
  32.     SceneManager.call(Scene_Collection)
  33.   end
  34. end
  35.  
  36. class Scene_Collection < Scene_Item
  37.   #--------------------------------------------------------------------------
  38.   # ● [别名修改]生成分类窗口
  39.   #--------------------------------------------------------------------------
  40.   alias create_category_window_for_hide create_category_window
  41.   def create_category_window
  42.     create_category_window_for_hide
  43.     @category_window.deactivate
  44.     @category_window.hide
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● [覆盖]生成物品窗口
  48.   #--------------------------------------------------------------------------
  49.   def create_item_window
  50.     wy = @help_window.y + @help_window.height
  51.     wh = Graphics.height - wy
  52.     @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)
  53.     @item_window.viewport = @viewport
  54.     @item_window.help_window = @help_window
  55.     @item_window.set_handler(:cancel, method(:return_scene))
  56.     @item_window.category = :key_item
  57.     @item_window.activate
  58.     @item_window.select_last
  59.   end
  60. end

作者: 何伦伦    时间: 2020-3-3 13:48
提示: 作者被禁止或删除 内容自动屏蔽




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