rebf-gaiden/Scripts/_.31.rb
2025-04-26 17:06:34 -05:00

90 lines
No EOL
3.9 KiB
Ruby

module WD_itemdictionary_layout
#設定項目 メニューに表示される図鑑コマンドの名前
#メニューに表示しない場合は nil
ITEM_DIC_COMMAND_NAME = "図鑑"
end
#==============================================================================
# ■ Scene_ItemDictionary
#==============================================================================
class Scene_ItemDictionary < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_status_window
create_item_window
create_perfection_window
end
#--------------------------------------------------------------------------
# ● アイテムウィンドウの作成
#--------------------------------------------------------------------------
def create_item_window
wy = @help_window.y + @help_window.height
wh = Graphics.height - wy - 48
@item_window = Window_ItemDictionaryList.new(Graphics.width-250-48, wy, 250+48, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.status_window = @status_window
@item_window.set_handler(:cancel, method(:return_scene))
@item_window.refresh
@item_window.select(0)
@item_window.activate
end
#--------------------------------------------------------------------------
# ● アイテムステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_status_window
wy = @help_window.y + @help_window.height
wh = Graphics.height - wy
@status_window = Window_ItemDictionaryStatus.new(0, wy, Graphics.width-250-48, wh)
@status_window.viewport = @viewport
@status_window.set_item(nil)
end
end
#==============================================================================
# ■ Window_ItemDictionaryList
#==============================================================================
class Window_ItemDictionaryList < Window_Selectable
#--------------------------------------------------------------------------
# ● アイテムをリストに含めるかどうか
#--------------------------------------------------------------------------
def include?(item)
item.is_a?(RPG::Armor)
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias :dictionary_create_command_window :create_command_window
def create_command_window
dictionary_create_command_window
@command_window.set_handler(:item_dictionary, method(:command_item_dictionary))
end
#--------------------------------------------------------------------------
# ● コマンド[図鑑]
#--------------------------------------------------------------------------
def command_item_dictionary
SceneManager.call(Scene_ItemDictionary)
end
end
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# ● 独自コマンドの追加用
#--------------------------------------------------------------------------
def add_original_commands
return if WD_itemdictionary_layout::ITEM_DIC_COMMAND_NAME == nil
add_command(WD_itemdictionary_layout::ITEM_DIC_COMMAND_NAME, :item_dictionary, main_commands_enabled)
end
end