Code:
#==============================================================================
# â–� Window_ScrollBar
#------------------------------------------------------------------------------
#  Window_Selectableクラスã?®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã?«ã‚¹ã‚¯ãƒãƒ¼ãƒ«ãƒ?ーを表示ã?—ã?¾ã?™ã€‚
#  使用時ã?¯ã€?クラスå� …ã?§å®£è¨€ã?—ã€?updateメソッドç‰ã?§updateã?™ã‚‹å¿…è¦?ã?Œã?‚ã‚� ã?¾ã?™ã€‚
#  ���ウィンドウ開放時�����dispose�る必���� ��。
#==============================================================================
class Window_ScrollBar
# 定数定義
GRAPHIC_PATH = "./Graphics/Windowskins/"
#--------------------------------------------------------------------------
# � オブジェクト�期化
#--------------------------------------------------------------------------
# x : X 座標
# y : Y 座標
# height : 高�(32以� )
# ※width�サイズ固定(16)。
#--------------------------------------------------------------------------
def initialize(x, y, height, bar_graphic)
# heightã?Œ32未満ã?®å� ´å?ˆã?¯è‡ªå‹•çš„ã?«32ã?«è¨å®š
height = [height, 32].max
# スクãƒãƒ¼ãƒ«ãƒ?ー用グラフィックデータèªã?¿è¾¼ã?¿
# ã‚ャッシュ化ã?—ã?Ÿæ–¹ã?Œæ—©ã?„ã?‹ã‚‚ã?—ã‚Œã?ªã?„。
if FileTest.exist?(GRAPHIC_PATH + bar_graphic)
@bar_graphic = Bitmap.new(GRAPHIC_PATH + bar_graphic)
else
@bar_graphic = nil
end
# スクãƒãƒ¼ãƒ«ãƒ?ー用スプライト作æˆ?
@sprite_view = Viewport.new(x, y, 16, height)
@sprite_view.z = 100
@bar_sprite = Sprite.new(@sprite_view)
@bar_sprite.bitmap = Bitmap.new(16, height)
end
#--------------------------------------------------------------------------
# � 解放
#--------------------------------------------------------------------------
def dispose
# スクãƒãƒ¼ãƒ«ãƒ?ー用ã‚ャッシュデータ開放
if @bar_graphic != nil
unless @bar_graphic.disposed?
@bar_graphic.dispose
end
end
# スクãƒãƒ¼ãƒ«ãƒ?ー用スプライト開放
unless @bar_sprite.disposed?
@bar_sprite.dispose
end
end
#--------------------------------------------------------------------------
# â—? update
#--------------------------------------------------------------------------
# window:�照先�ウィンドウ(通常�selfを代入)
# 返� 値:処� ����返�れ��(デ�ッグ用)。
#--------------------------------------------------------------------------
def update(window)
# bitmap�クリア
@bar_sprite.bitmap.clear
# ãƒ?ーグラフィックã?Œå˜åœ¨ã?—ã?ªã?„å� ´å?ˆã?¯falseã‚’è¿”ã?™
if @bar_graphic == nil
return false
end
# ãƒ?ーã?®ä¸‹åœ°ã‚’æ??ç”»
@bar_sprite.bitmap.blt(0, 0, @bar_graphic, Rect.new(0, 0, 16, 16))
@bar_sprite.bitmap.blt(0, @bar_sprite.bitmap.height - 16, @bar_graphic, Rect.new(0, 32, 16, 16))
if @bar_sprite.bitmap.height > 32
@bar_sprite.bitmap.stretch_blt(Rect.new(0, 16, 16, @bar_sprite.bitmap.height - 32), @bar_graphic, Rect.new(0, 16, 16, 16))
end
# スクãƒãƒ¼ãƒ«ãƒ?ーã?®æ??画座標を計算
if window.row_max > 0
bar_height = [100 * window.page_row_max / window.row_max, 100].min
bar_height = [bar_height * @bar_sprite.bitmap.height / 100, 32].max
bar_y = 100 * window.top_row / [window.row_max - window.page_row_max, 1].max
bar_y = (@bar_sprite.bitmap.height - bar_height) * bar_y / 100
else
bar_height = @bar_sprite.bitmap.height
bar_y = 0
end
# スクãƒãƒ¼ãƒ«ãƒ?ーをæ??ç”»
@bar_sprite.bitmap.blt(0, bar_y, @bar_graphic, Rect.new(16, 0, 16, 16))
@bar_sprite.bitmap.blt(0, bar_y + bar_height - 16, @bar_graphic, Rect.new(16, 32, 16, 16))
if bar_height > 32
@bar_sprite.bitmap.stretch_blt(Rect.new(0, bar_y + 16, 16, bar_height - 32), @bar_graphic, Rect.new(16, 16, 16, 16))
end
# ��コード���trueを返�
return true
end
end
#END
#####################################################
Now Here a sample of the window item, replace it with this
#==============================================================================
# â–� Window_Item(スクãƒãƒ¼ãƒ«ãƒ?ー導入サンプル)
#------------------------------------------------------------------------------
#  デフォルトã?®Itemウィンドウã?«ã‚¹ã‚¯ãƒãƒ¼ãƒ«ãƒ?ーを導入ã?—ã?¾ã?™ã€‚
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# � オブジェクト�期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
refresh
self.index = 0
# 戦闘ä¸ã?®å� ´å?ˆã?¯ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ç”»é?¢ä¸å¤®ã?¸ç§»å‹•ã?—ã€?å?� é€?明ã?«ã?™ã‚‹
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
# スクãƒãƒ¼ãƒ«ãƒ?ー定義(追å� � )
@scroll = Window_ScrollBar.new(self.x + self.width - 16, self.y, self.height, "sample.png")
@scroll.update(self)
end
#--------------------------------------------------------------------------
# â—? update(追å� � )
#--------------------------------------------------------------------------
def update
super
@scroll.update(self)
end
#--------------------------------------------------------------------------
# â—? dispose(追å� � )
#--------------------------------------------------------------------------
def dispose
super
@scroll.dispose
end
end