Public feed
#381529
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# The Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
@spriteset = Sprite.new
@spriteset.bitmap = RPG::Cache.title($data_system.title_name)
@command_window = Window_Menucommand.new
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 640 - @status_window.width - 5
@status_window.y = @command_window.height + 10
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 640 - @status_window.width - 5
@gold_window.y = @command_window.height + @status_window.height + 15
@gold_window.width = @status_window.width
@gold_window.height = 480 - 64 - 250 - 20
@variable_window = Window_Variables.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@variable_window.dispose
@command_window.dispose
@gold_window.dispose
@spriteset.bitmap.dispose
@status_window.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
#@spriteset.update
@variable_window.update
@command_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # save
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Save.new
when 1 # load
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
$scene = Scene_Load2.new
when 2 # exit
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
$scene = Scene_End.new
end
return
end
end
end