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

121 lines
5.1 KiB
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ++ タイトル画面カスタマイズ [RGSS3] ver. 1.00 
#  Script by パラ犬
#------------------------------------------------------------------------------
# タイトル画面のコマンドに画像を使用できるようにします。
#==============================================================================
class Window_TitleCommand < Window_Command
#------------------------------------------------------------------------------
# ↓ 簡単に設定できるように設定項目を切り出し
# 行目メニューコマンドに使う画像ファイル名「Graphics/Titles1」に入れる
#      書式は [ コマンド未選択時 , コマンドが選択されたとき ]
# 行目画像の表示位置X座標
# 行目画像の表示位置Y座標
# ニューゲーム
IMG_NEWGAME = ["title_btn1B","title_btn1A"]
IMG_NEWGAME_X = 100 # 横位置
IMG_NEWGAME_Y = 280 # 縦位置
# コンティニュー
IMG_CONTINUE = ["title_btn2B","title_btn2A"]
IMG_CONTINUE_X = 100 # 横位置
IMG_CONTINUE_Y = 330 # 縦位置
# シャットダウン
IMG_SHUTDOWN = ["title_btn3B","title_btn3A"]
IMG_SHUTDOWN_X = 100 # 横位置
IMG_SHUTDOWN_Y = 380 # 縦位置
# ↑ 設定項目ここまで
#------------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ○ 画像コマンドウィンドウの作成
#--------------------------------------------------------------------------
def create_command_sprite
# ニューゲーム
sprite1 = Sprite.new
sprite1.x = IMG_NEWGAME_X
sprite1.y = IMG_NEWGAME_Y
# コンティニュー
sprite2 = Sprite.new
sprite2.x = IMG_CONTINUE_X
sprite2.y = IMG_CONTINUE_Y
# シャットダウン
sprite3 = Sprite.new
sprite3.x = IMG_SHUTDOWN_X
sprite3.y = IMG_SHUTDOWN_Y
# スプライトを配列で管理
@command_sprites = [sprite1, sprite2, sprite3]
# ビットマップファイル名を配列で管理
@command_bitmaps = [IMG_NEWGAME, IMG_CONTINUE, IMG_SHUTDOWN]
end
#--------------------------------------------------------------------------
# ○ メニュー選択時の画像切り替え
#--------------------------------------------------------------------------
def select_command_sprite(index)
# 全てのスプライトに[コマンド未選択時]のビットマップをつっこむ
@command_sprites[0].bitmap = Cache.title1(@command_bitmaps[0][0])
@command_sprites[1].bitmap = Cache.title1(@command_bitmaps[1][0])
@command_sprites[2].bitmap = Cache.title1(@command_bitmaps[2][0])
# 選択されている項目のビットマップを[コマンドが選択されたとき]に変える
@command_sprites[index].bitmap = Cache.title1(@command_bitmaps[index][1])
end
#--------------------------------------------------------------------------
# ○ 項目の描画
#--------------------------------------------------------------------------
def set_enabled_command_sprite(index, enabled)
if enabled
@command_sprites[index].opacity = 255
else
# 選択不可の項目は不透明度を下げる
@command_sprites[index].opacity = 160
end
end
#--------------------------------------------------------------------------
# ○ 解放
#--------------------------------------------------------------------------
def dispose_command_sprite
if @command_sprites != nil
@command_sprites[0].dispose
@command_sprites[1].dispose
@command_sprites[2].dispose
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# 呼び出し:○画像コマンドウィンドウの作成
create_command_sprite
# 元からあるコマンドウインドウを非表示にする
self.visible = false
super
end
#--------------------------------------------------------------------------
# ● カーソル位置の設定
#--------------------------------------------------------------------------
def index=(index)
super
# 呼び出し:○メニュー選択時の画像切り替え
select_command_sprite(index)
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
super
# 呼び出し:○項目の描画
set_enabled_command_sprite(index, command_enabled?(index))
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
# 呼び出し:○解放
dispose_command_sprite
super
end
end