Code:
#============================================================================
# * A Simple OK dialog
#============================================================================
class Dialog_Ok < Dialog
# self.value: false = No, true = Yes
#--------------------------------------------------------------------------
# * A show method
#--------------------------------------------------------------------------
def initialize(text = nil)
# Sets the text for the help window
@text = text
end
#--------------------------------------------------------------------------
# * Create the windows
#--------------------------------------------------------------------------
def main_window
@disposables = []
# The command window
@command_window = Window_Command.new(80, ['OK'])
@command_window.index = 0
@command_window.x = (640 - @command_window.width) / 2
@command_window.y = (480 - @command_window.height) / 2
@command_window.z = STARTING_Z_VALUE + 1
@disposables << @command_window
# The text window
if @text.is_a?(String)
@text_window = Window_Help.new
@text_window.set_text(@text, 1)
@text_window.z = STARTING_Z_VALUE + 1
@disposables << @text_window
end
end
#--------------------------------------------------------------------------
# * Dispose the windows
#--------------------------------------------------------------------------
def main_dispose
@disposables.each {|element| element.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@command_window.update
if Input.trigger?(Input::B)
mark_to_close
end
if Input.trigger?(Input::C)
mark_to_close
end
end
end