#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# タイトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
if $BTEST # 戦闘テストの場合
battle_test # 戦闘テストの開始処理
else # 通常のプレイの場合
super # 本来のメイン処理
end
end
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
load_database # データベースをロード
create_game_objects # ゲームオブジェクトを作成
check_continue # コンティニュー有効判定
create_title_graphic # タイトルグラフィックを作成
#create_command_window # コマンドウィンドウを作成
new_command
play_title_music # タイトル画面の音楽を演奏
end
#--------------------------------------------------------------------------
# ● トランジション実行
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(20)
end
#--------------------------------------------------------------------------
# ● 開始後処理
#--------------------------------------------------------------------------
def post_start
super
#open_command_window
end
#--------------------------------------------------------------------------
# ● 終了前処理
#--------------------------------------------------------------------------
def pre_terminate
super
#close_command_window
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
def terminate
super
#dispose_command_window
snapshot_for_background
dispose_title_graphic
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
#@command_window.update
new_inputupdate
if Input.trigger?(Input::C)
case @command_index
when 0 # ニューゲーム
command_new_game
when 1 # コンティニュー
command_continue
when 2 # シャットダウン
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# ● データベースのロード
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata2")
$data_classes = load_data("Data/Classes.rvdata2")
$data_skills = load_data("Data/Skills.rvdata2")
$data_items = load_data("Data/Items.rvdata2")
$data_weapons = load_data("Data/Weapons.rvdata2")
$data_armors = load_data("Data/Armors.rvdata2")
$data_enemies = load_data("Data/Enemies.rvdata2")
$data_troops = load_data("Data/Troops.rvdata2")
$data_states = load_data("Data/States.rvdata2")
$data_animations = load_data("Data/Animations.rvdata2")
$data_common_events = load_data("Data/CommonEvents.rvdata2")
$data_system = load_data("Data/System.rvdata2")
end
#--------------------------------------------------------------------------
# ● 戦闘テスト用データベースのロード
#--------------------------------------------------------------------------
def load_bt_database
$data_actors = load_data("Data/BT_Actors.rvdata2")
$data_classes = load_data("Data/BT_Classes.rvdata2")
$data_skills = load_data("Data/BT_Skills.rvdata2")
$data_items = load_data("Data/BT_Items.rvdata2")
$data_weapons = load_data("Data/BT_Weapons.rvdata2")
$data_armors = load_data("Data/BT_Armors.rvdata2")
$data_enemies = load_data("Data/BT_Enemies.rvdata2")
$data_troops = load_data("Data/BT_Troops.rvdata2")
$data_states = load_data("Data/BT_States.rvdata2")
$data_animations = load_data("Data/BT_Animations.rvdata2")
$data_common_events = load_data("Data/BT_CommonEvents.rvdata2")
$data_system = load_data("Data/BT_System.rvdata2")
end
#--------------------------------------------------------------------------
# ● 各種ゲームオブジェクトの作成
#--------------------------------------------------------------------------
def create_game_objects
$game_temp = Game_Temp.new
$game_message = Game_Message.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
end
#--------------------------------------------------------------------------
# ● コンティニュー有効判定
#--------------------------------------------------------------------------
def check_continue
@continue_enabled = (Dir.glob('Save*.rvdata2').size > 0)
end
#--------------------------------------------------------------------------
# ● タイトルグラフィックの作成
#--------------------------------------------------------------------------
def create_title_graphic
@sprite_1 = Sprite.new
@sprite_1.bitmap = Cache.system("Title")
end
#--------------------------------------------------------------------------
# ● タイトルグラフィックの解放
#--------------------------------------------------------------------------
def dispose_title_graphic
@sprite_1.bitmap.dispose
@sprite_1.dispose
for i in 0..5
@sprite[i].bitmap.dispose
@sprite[i].dispose
end
end
#--------------------------------------------------------------------------
# ● タイトル画面の音楽演奏
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
#--------------------------------------------------------------------------
# ● プレイヤーの初期位置存在チェック
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "プレイヤーの初期位置が設定されていません。"
exit
end
end
#--------------------------------------------------------------------------
# ● コマンド : ニューゲーム
#--------------------------------------------------------------------------
def command_new_game
confirm_player_location
Sound.play_decision
$game_party.setup_starting_members # 初期パーティ
$game_map.setup($data_system.start_map_id) # 初期位置のマップ
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
#close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# ● コマンド : コンティニュー
#--------------------------------------------------------------------------
def command_continue
if @continue_enabled
Sound.play_decision
$scene = Scene_File.new(false, true, false)
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● コマンド : シャットダウン
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# ● 戦闘テスト
#--------------------------------------------------------------------------
def battle_test
load_bt_database # 戦闘テスト用データベースをロード
create_game_objects # ゲームオブジェクトを作成
Graphics.frame_count = 0 # プレイ時間を初期化
$game_party.setup_battle_test_members
$game_troop.setup($data_system.test_troop_id)
$game_troop.can_escape = true
$game_system.battle_bgm.play
snapshot_for_background
$scene = Scene_Battle.new
end
#=========================================================================
#★定义新的标题选择菜单
#=========================================================================
def new_command
@sprite = [Sprite.new]
for i in 0..5
@sprite[i]= Sprite.new
@sprite[i].opacity = 0
@sprite[i].x = 0
@sprite[i].y = 0
end
@sprite[0].bitmap = Bitmap.new("Graphics/Pictures/start_1")
@sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start_2")
@sprite[2].bitmap = Bitmap.new("Graphics/Pictures/continue_1")
@sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue_2")
@sprite[4].bitmap = Bitmap.new("Graphics/Pictures/exit_1")
@sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit_2")
@command_index = 0
if @continue_enabled
@command_index=1
else
@sprite[2].tone = Tone.new(0,0,0,255)
@sprite[3].tone = Tone.new(0,0,0,255)
end
end
#==========================================================================
#★new_iputupdate
#==========================================================================
def new_inputupdate
if Input.trigger?(Input::UP)
@command_index -= 1
if @command_index < 0
@command_index = 2
end
$data_system.sounds[0].play
end
if Input.trigger?(Input::DOWN)
@command_index += 1
if @command_index > 2
@command_index = 0
end
$data_system.sounds[0].play
end
case @command_index
when 0
if @sprite[0].opacity >= 0
@sprite[0].opacity -= 30
end
if @sprite[1].opacity <= 240
@sprite[1].opacity += 30
end
if @sprite[2].opacity <= 210
@sprite[2].opacity += 30
end
if @sprite[3].opacity >= 0
@sprite[3].opacity -= 30
end
if @sprite[4].opacity <= 210
@sprite[4].opacity += 30
end
if @sprite[5].opacity >= 0
@sprite[5].opacity -= 30
end
when 1
if @sprite[0].opacity <= 210
@sprite[0].opacity += 30
end
if @sprite[1].opacity >= 0
@sprite[1].opacity -= 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity <= 240
@sprite[3].opacity += 30
end
if @sprite[4].opacity <= 210
@sprite[4].opacity += 30
end
if @sprite[5].opacity >= 0
@sprite[5].opacity -= 30
end
when 2
if @sprite[0].opacity <= 210
@sprite[0].opacity += 30
end
if @sprite[1].opacity >= 0
@sprite[1].opacity -= 30
end
if @sprite[2].opacity <= 210
@sprite[2].opacity += 30
end
if @sprite[3].opacity >= 0
@sprite[3].opacity -= 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity <= 240
@sprite[5].opacity += 30
end
end
end
end