Ruby on RGSS
非消費アイテム∞表示
データベースで、「消費しない」になっているアイテムの個数のところに、
個数の変わりに「∞」を表示します。
見ての通りですが、あまり使えません。
(まだRGSSがよく分かってないときに作ったものなので)
# 非消費アイテム∞表示 Ver 1.0 by 半導体 # http://h2so5.web.fc2.com/ # 概要:アイテムウィンドウで、消費しない設定になっているアイテムを、 # 個数ではなくかわりに「∞」マークで表示させます。 # ただし、個数は分からなくなります。消費しないアイテムの個数を知っても # あまり意味は無いと思いますが...。 #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) #アイテムが消費するなら個数、しないなら「∞」マークを表示 if item.consumable self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) else self.contents.draw_text(x + 256, y, 24, 32, "∞", 2) end end end
Back