lunariafantasia/Scripts/_Window_.2.rb
2024-01-12 03:12:38 -06:00

139 lines
5.3 KiB
Ruby

#==============================================================================
# □ Window_CategoryBase
#------------------------------------------------------------------------------
#  道具・調合画面等で、カテゴリを選択するウィンドウのベース。
#==============================================================================
class Window_CategoryBase < Window_Command
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0)
super(x, y)
self.z = 200
self.back_opacity = 180
end
#--------------------------------------------------------------------------
# ○ アライメントの取得
#--------------------------------------------------------------------------
def alignment
return 1
end
#--------------------------------------------------------------------------
# ○ 横に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 8
end
end
#==============================================================================
# □ Window_ItemCategory_Extra
#------------------------------------------------------------------------------
#  アイテム画面用のオリジナルカテゴリウィンドウ
#==============================================================================
class Window_ItemCategory_Extra < Window_CategoryBase
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
end
#--------------------------------------------------------------------------
# ○ ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
#Graphics.width / 4
70 * col_max + 20
end
#--------------------------------------------------------------------------
# ○ 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ○ 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
(item_max - 1) / col_max + 1
end
#--------------------------------------------------------------------------
# ○ フレーム更新
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# ○ コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::item, :item)
add_command(Vocab::key_item, :key_item)
add_command(Vocab::weapon, :weapon)
add_command(Vocab::armor, :armor)
add_command(Vocab::rune, :rune)
add_command(Vocab::skill, :skill_book)
end
#--------------------------------------------------------------------------
# ○ アイテムウィンドウの設定
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
#  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● アイテムをリストに含めるかどうか ※再定義
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item? && !item.skill_book? && !item.hide_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor) && !item.rune?
when :rune
item.is_a?(RPG::Armor) && item.rune?
when :key_item
item.is_a?(RPG::Item) && item.key_item? && !item.hide_item?
when :skill_book
item.is_a?(RPG::Item) && !item.key_item? && item.skill_book?
else
false
end
end
#--------------------------------------------------------------------------
# ● アイテムの個数を描画
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
case @category
when :skill_book
return
else
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
end
end
class RPG::BaseItem
def hide_item?
self.note.include?("<リスト非表示>")
end
end