#==============================================================================
# ** Decision
#------------------------------------------------------------------------------
# Author S.S Muu
# Version 1.0
# Date 01-07-09 (dd-mm-yy)
#==============================================================================
class Decision < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(220, 150, 200, 110)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 10000
end
#--------------------------------------------------------------------------
# * Start
#--------------------------------------------------------------------------
def start
self.active = true
@yes = false
@ret = false
refresh
main_loop
# Return with the decision
return @yes
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if a decision has been made
if @ret
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
self.dispose
# Execute transition
Graphics.transition
# Update game screen
Graphics.update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# If the right or left directional button was pressed
if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
move_cursor
end
# If the C button was pressed
if Input.trigger?(Input::C)
case @yes
when true
$game_system.se_play($data_system.decision_se)
when false
$game_system.se_play($data_system.cancel_se)
end
@ret = true
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 168, 40, "Are you sure?", 1)
self.contents.draw_text(0, 40, 168, 40, "Yes No", 1)
self.cursor_rect.set(95, 45, 48, 32)
end
#--------------------------------------------------------------------------
# * Move Cursor
#--------------------------------------------------------------------------
def move_cursor
$game_system.se_play($data_system.cursor_se)
@yes = !@yes
if @yes
self.cursor_rect.set(30, 45, 48, 32)
else
self.cursor_rect.set(95, 45, 48, 32)
end
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Display decision window
dec = Decision.new
# Save if "Yes" was chosen
if dec.start
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(4)
end
end
end