Advertisement
diamondandplatinum3

Sound Test Scene ~ CSV Version ~ RGSS3

Sep 29th, 2013
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 48.25 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Sound Test Scene ~ CSV Version
  3. #             Version: 1.0
  4. #             Author: DiamondandPlatinum3
  5. #             Date: September 30, 2013
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script creates a new scene in your game which allows you to listen to
  10. #    music that is played throughout your game. It also allows for some
  11. #    customisation to be made when playing a sound, such as modifying Volume,
  12. #    Pitch and/or Position.
  13. #    Music can also be locked until a certain Event Switch is turned on.
  14. #
  15. #    It also allows you to have categories for your Sound Files and individual
  16. #    album art for each audio file.
  17. #
  18. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. #------------------------------------------------------------------------------
  20. #  Instructions:
  21. #
  22. #  ~  You can load the SoundTestScene at anytime by inputting the following in
  23. #     a script call:
  24. #                       SceneManager.call(Scene_SoundTest)
  25. #
  26. #
  27. #  ~  These instructions assume you know how to create/edit an CSV file, if you
  28. #     do not know how to do so, it may be better if you used another version of
  29. #     this script.
  30. #
  31. #
  32. #  ~  Get the CSV file that was posted along with this script. Modify it until
  33. #     you're content with it.
  34. #           Available here:       http://www.mediafire.com/?gk6p4go3g9a409g
  35. #
  36. #
  37. #  ~  Place the CSV file you just modded to the root directory of your game.
  38. #
  39. #
  40. #  ~  Modify the Editable Region Below as Needed.
  41. #
  42. #
  43. #  ~  Be sure your Album Art Images are placed in the approriate folder.
  44. #
  45. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. module DiamondandPlatinum3
  47.   module SoundTestScene
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     #                                                        -=
  50.     #                 Editable Region        ////            ==
  51.     #                                                        =-
  52.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  53.  
  54.     # The Filename for the CSV File You wish to load
  55.     CSV_Filename                        = "SoundTest Database"
  56.    
  57.    
  58.     # Text to be Displayed when Selecting a Category
  59.     CategorySelectHelpWindowTextLine1   = "Select a Category"
  60.     CategorySelectHelpWindowTextLine2   = "Press 'Esc or X' to Exit"
  61.    
  62.     # Text to be displayed on the help window when Selecting a Sound
  63.     SoundSelectHelpWindowTextLine1      = "Select a Sound"
  64.     SoundSelectHelpWindowTextLine2      = "Press 'Esc or X' to Exit"
  65.    
  66.     # Text to be displayed on the help window when Hovering over the 'Play Sound' Option
  67.     PlaySoundOptionHelpWindowTextLine1  = "Select To Play Sound"
  68.     PlaySoundOptionHelpWindowTextLine2  = "(Default Settings)"
  69.    
  70.     # Text to be displayed on the help window when Hovering over the 'Volume' Option
  71.     VolumeOptionHelpWindowTextLine1     = "Select To Play Sound"
  72.     VolumeOptionHelpWindowTextLine2     = "(At Specific Volume)"
  73.    
  74.     # Text to be displayed on the help window when Hovering over the 'Pitch' Option
  75.     PitchOptionHelpWindowTextLine1      = "Select To Play Sound"
  76.     PitchOptionHelpWindowTextLine2      = "(At Specific Pitch)"
  77.    
  78.     # Text to be displayed on the help window when Hovering over the 'Position' Option
  79.     PositionOptionHelpWindowTextLine1   = "Select To Play Sound At Specific Position"
  80.     PositionOptionHelpWindowTextLine2   = "(Only works for WAV & OGG Files)"
  81.    
  82.     # Text to be displayed on the help window when inputting a value in the NuberInput Window
  83.     NumberInputHelpWindowTextLine1      = "Input A Value"
  84.     NumberInputHelpWindowTextLine2      = ""
  85.    
  86.    
  87.    
  88.     # Where Will the Script Find the Album Art Associated with the Music?
  89.     AlbumArtFolder                      = "Graphics/Pictures/"
  90.    
  91.    
  92.     # Filename of Background Image to be Displayed if no Album Art is provided
  93.     # If You do not want a default image, leave an empty string ( "" )
  94.     DefaultBackgroundSpriteFilename     = "SoundTest_BackgroundImage"
  95.    
  96.    
  97.    
  98.     # Position only works with Wav|Ogg files, if you're lacking these filetypes,
  99.     # then the Position command is pretty awkward, you can disable it here.
  100.     EnablePositionCommand               = true
  101.    
  102.    
  103.    
  104.     # If Enabled, Windows will animate into the scene when entered (either via
  105.     #  transparency or by flying in).
  106.     # If Disabled, all windows will be there from the get-go
  107.     EnableIntroAnimation                = true
  108.    
  109.    
  110.    
  111.     # If Enabled, The SoundTestScene will be available to select in the Main Menu
  112.     EnableMenuOption                    = true
  113.    
  114.    
  115.     # The Text that is displayed for the Option in the Menu
  116.     MenuCommandText                     = "Sound Test"
  117.    
  118.    
  119.     # If Menu Enabled, this Switch (when activated) will allow the user to select
  120.     # the SoundTestScene. If not activated, no access will be granted to the scene
  121.     # via menu.
  122.     #
  123.     # If Set to Zero, the SoundTestScene will always be available via menu.
  124.     EnableSwitchID                      = 0
  125.    
  126.    
  127.    
  128.     # How Many Category Commands can be on one line? Modify this if you find
  129.     # your text being cut off.
  130.     MaxCategoryHorizontalCommands       = 3
  131.    
  132.    
  133.    
  134.     # Categories of Music to be used in the Scene, add as many as you'd like
  135.     Music_Categories =
  136.     [
  137.    
  138.       "Battle Themes",
  139.       "Event Themes",
  140.       "Town Themes",
  141.       "Overworld Themes",
  142.      
  143.     ]
  144.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  145.     #                                           \/
  146.     #               End of Editable Region      /\
  147.     #                                           \/
  148.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  149.     #---------------------------------------------------------
  150.     # No touchie past here unless you know what you are
  151.     # doing. Failure to heed this warning could cause your
  152.     # computer to yell and scream at you.
  153.     #
  154.     # Edit at your own risk.
  155.     #---------------------------------------------------------
  156.  
  157.    
  158.    
  159.    
  160.    
  161.    
  162.    
  163.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  164.     # * New Method: Perform Temporary Compatibility Resolution
  165.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166.     def self.perform_temporary_compatibility_resolution()
  167.     end
  168.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  169.     # * New Method: Revert Temporary Compatibility Resolution
  170.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  171.     def self.revert_temporary_compatibility_resolution()
  172.     end
  173.   end
  174. end
  175.  
  176.  
  177.  
  178.  
  179. #==============================================================================
  180. # ** SoundTestSound
  181. #------------------------------------------------------------------------------
  182. #  This is a class which hold Individual Sound Information for Play
  183. #==============================================================================
  184.  
  185. class SoundTestSound
  186.   include DiamondandPlatinum3::SoundTestScene
  187.   #--------------------------------------------------------------------------
  188.   # * Public Instance Variables
  189.   #--------------------------------------------------------------------------
  190.   attr_accessor :filename
  191.   attr_accessor :name
  192.   attr_accessor :default_volume
  193.   attr_accessor :volume
  194.   attr_accessor :default_pitch
  195.   attr_accessor :pitch
  196.   attr_accessor :position
  197.   attr_accessor :info_text
  198.   attr_accessor :albumart_filename
  199.   #--------------------------------------------------------------------------
  200.   # * Intialize
  201.   #--------------------------------------------------------------------------
  202.   def initialize( csv_line )
  203.     @filename           = csv_line[0]
  204.     @name               = csv_line[1]
  205.     @default_volume     = csv_line[2].to_i
  206.     @volume             = @default_volume
  207.     @default_pitch      = csv_line[3].to_i
  208.     @pitch              = @default_pitch  
  209.     @position           = 0
  210.     @info_text          = csv_line[6] + "\n" + csv_line[7] + "\n" + csv_line[8] + "\n" + csv_line[9]
  211.     @albumart_filename  = (csv_line[10] ||= "")
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # * Play Sound
  215.   #--------------------------------------------------------------------------
  216.   def play()
  217.     RPG::BGM.stop()
  218.     RPG::BGM.new( @filename, volume, pitch ).play
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # * Play Sound at Position
  222.   #--------------------------------------------------------------------------
  223.   def play_at_position( position )
  224.     @position = position
  225.     RPG::BGM.stop()
  226.     RPG::BGM.new( @filename, volume, pitch ).play( position )
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # * Play Sound ( Default )
  230.   #--------------------------------------------------------------------------
  231.   def default_play()
  232.     RPG::BGM.stop()
  233.     RPG::BGM.new( @filename, @default_volume, @default_pitch ).play
  234.   end
  235. end
  236.  
  237.  
  238.  
  239.  
  240.  
  241. #==============================================================================
  242. # ** Scene_SoundTest
  243. #------------------------------------------------------------------------------
  244. #  This Clas Holds the Scene Information for the SoundTest
  245. #==============================================================================
  246.  
  247. class Scene_SoundTest < Scene_Base
  248.   include DiamondandPlatinum3::SoundTestScene
  249.   #--------------------------------------------------------------------------
  250.   # * Start Processing
  251.   #--------------------------------------------------------------------------
  252.   def start
  253.     super()
  254.     DiamondandPlatinum3::SoundTestScene::perform_temporary_compatibility_resolution()
  255.    
  256.     valid_csv_file = create_soundtestfiles_hash()
  257.     if is_valid_scene?()
  258.       save_current_bgm()
  259.       create_album_art_hash()
  260.       create_command_windows()
  261.       create_help_window()
  262.       create_soundinfo_window()
  263.       create_numberinput_window()
  264.       set_input_variables()
  265.       setup_scene_intro_animation()   if EnableIntroAnimation
  266.     else
  267.       if valid_csv_file
  268.         msgbox_p("There are no Sounds to listen to")
  269.       else
  270.         msgbox_p("Cannot find file '#{CSV_Filename + ".csv"}' ")
  271.       end
  272.       return_scene()
  273.     end
  274.    
  275.     # Current Selected Sound
  276.     @current_sound_symbol = nil
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # * Post-Start Processing
  280.   #--------------------------------------------------------------------------
  281.   def post_start
  282.     if is_valid_scene?()
  283.       super()
  284.       animate_intro_scene()   if EnableIntroAnimation
  285.     end
  286.   end  
  287.   #--------------------------------------------------------------------------
  288.   # * Frame Update
  289.   #--------------------------------------------------------------------------
  290.   def update
  291.     super()
  292.    
  293.     @sound_select_cmmdwindows[get_category()].update()
  294.    
  295.     update_sounds_visibility()
  296.     update_window_info_text()
  297.     update_album_art_image()
  298.     update_help_text()
  299.     update_scene_changes()
  300.     update_user_input()
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # * Pre-Termination Processing
  304.   #--------------------------------------------------------------------------
  305.   def pre_terminate
  306.     super()
  307.    
  308.     @current_map_bgm.replay() unless @current_map_bgm.nil?
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # * Termination Processing
  312.   #--------------------------------------------------------------------------
  313.   def terminate
  314.     @soundcategory_commandwindow.dispose()  unless @soundcategory_commandwindow.nil?  || @soundcategory_commandwindow.disposed?
  315.     @sound_play_cmmdwindow.dispose()        unless @sound_play_cmmdwindow.nil?        || @sound_play_cmmdwindow.disposed?
  316.     @help_window.dispose()                  unless @help_window.nil?                  || @help_window.disposed?
  317.     @sound_info_window.dispose()            unless @sound_info_window.nil?            || @sound_info_window.disposed?
  318.     @numberinput_window.dispose()           unless @numberinput_window.nil?           || @numberinput_window.disposed?
  319.    
  320.     unless @sound_select_cmmdwindows.nil?
  321.       @sound_select_cmmdwindows.each_key do |category|
  322.         @sound_select_cmmdwindows[category].dispose() unless @sound_select_cmmdwindows[category].disposed?
  323.       end
  324.       @sound_select_cmmdwindows.clear()
  325.     end
  326.    
  327.     unless @album_art_hash.nil?
  328.       @album_art_hash.each_key do |key|
  329.         if @album_art_hash[key].is_a?(Sprite) && !@album_art_hash[key].disposed?
  330.           @album_art_hash[key].bitmap.dispose()
  331.           @album_art_hash[key].dispose()
  332.         end
  333.       end
  334.       @album_art_hash.clear()
  335.     end
  336.    
  337.     super()
  338.     DiamondandPlatinum3::SoundTestScene::revert_temporary_compatibility_resolution()
  339.   end  
  340.   #--------------------------------------------------------------------------
  341.   # * Create SoundTest Files Hash
  342.   #--------------------------------------------------------------------------
  343.   def create_soundtestfiles_hash()
  344.     @soundfiles_hash = {}
  345.     return false unless File.exists?(CSV_Filename + ".csv")
  346.    
  347.     # Get CSV Lines
  348.     csv_lines = Array.new()
  349.     file = File.open(CSV_Filename + ".csv", "r")
  350.     file.each_line do |line|
  351.       csv_lines << line.gsub("\n", "").split(/,\s*;?/) unless line.empty?
  352.     end
  353.     file.close()
  354.    
  355.     # Skip first line, since those are just labels
  356.     for i in 1..(csv_lines.size - 1)
  357.       if csv_lines[i][4].to_i < 1 || $game_switches[csv_lines[i][4].to_i]
  358.         category = check_if_valid_category(csv_lines[i][5]) ? csv_lines[i][5] : "Unaffiliated"
  359.         (@soundfiles_hash[category] ||= {})[ csv_lines[i][0] ] = SoundTestSound.new( csv_lines[i] )
  360.       end
  361.     end
  362.     csv_lines.clear()
  363.     return true
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # * Save Current BGM
  367.   #--------------------------------------------------------------------------
  368.   def save_current_bgm()
  369.     # Get Current BGM
  370.     @current_map_bgm = RPG::BGM.last
  371.     RPG::BGM.stop()
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # * Create Album Art Sprites
  375.   #--------------------------------------------------------------------------
  376.   def create_album_art_hash()
  377.     @album_art_hash = { :current_image_name => "", }
  378.    
  379.     if !DefaultBackgroundSpriteFilename.nil? && DefaultBackgroundSpriteFilename != ""
  380.       @album_art_hash[DefaultBackgroundSpriteFilename] = create_background_sprite(DefaultBackgroundSpriteFilename)
  381.       @album_art_hash[DefaultBackgroundSpriteFilename].visible = true
  382.       @album_art_hash[:current_image_name] = DefaultBackgroundSpriteFilename
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # * Create Background Sprite
  387.   #--------------------------------------------------------------------------
  388.   def create_background_sprite(filename)
  389.     image         = Sprite.new()
  390.     image.bitmap  = Bitmap.new(AlbumArtFolder + filename)
  391.     image.x       = 0
  392.     image.y       = 0
  393.     image.z       = 1
  394.     image.zoom_x  = (Graphics.width.to_f / image.bitmap.width)
  395.     image.zoom_y  = (Graphics.height.to_f / image.bitmap.height)
  396.     image.visible = false
  397.     return image
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * Create Command Windows
  401.   #--------------------------------------------------------------------------
  402.   def create_command_windows()
  403.     # Setting Up Command Window for the Sound Category
  404.     @soundcategory_commandwindow = Window_SoundTest_SoundCategoryCommand.new(0, 72)
  405.     command_window_ypos = (@soundcategory_commandwindow.y + @soundcategory_commandwindow.height)
  406.     set_soundcategorycommandwindow_handlers()
  407.    
  408.     # Setting Up Command Windows for Sounds
  409.     @sound_select_cmmdwindows = { }
  410.     Music_Categories.each do |category|
  411.       if !@soundfiles_hash[category].nil?
  412.         cmmdwindow = Window_SoundTest_SoundCommand.new(0, command_window_ypos, category)
  413.         cmmdwindow.height = Graphics.height - command_window_ypos
  414.         cmmdwindow.visible = false
  415.         @sound_select_cmmdwindows[category] = cmmdwindow
  416.       end
  417.     end
  418.     if !@soundfiles_hash["Unaffiliated"].nil?
  419.       cmmdwindow = Window_SoundTest_SoundCommand.new(0, command_window_ypos, "Unaffiliated")
  420.       cmmdwindow.height = Graphics.height - command_window_ypos
  421.       cmmdwindow.visible = false
  422.       @sound_select_cmmdwindows["Unaffiliated"] = cmmdwindow
  423.     end
  424.    
  425.     @sound_select_cmmdwindows[get_first_category()].visible = true
  426.     set_soundcommand_window_handlers()
  427.    
  428.     @sound_select_cmmdwindows.each_key do |category|
  429.       @sound_select_cmmdwindows[category].deactivate()
  430.     end
  431.    
  432.     # Setting Up Command Window for Play Sound
  433.     @sound_play_cmmdwindow = Window_SoundTest_PlayCommand.new(Graphics.width * 0.5, command_window_ypos)
  434.     @sound_play_cmmdwindow.deactivate()
  435.     set_soundplay_window_handlers()
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # * Set Sound Category Command Handlers
  439.   #--------------------------------------------------------------------------
  440.   def set_soundcategorycommandwindow_handlers()
  441.     Music_Categories.each do |category|
  442.       @soundcategory_commandwindow.set_handler(category.to_sym, method(:deactivate_soundcategory_window))
  443.     end
  444.     if !@soundfiles_hash["Unaffiliated"].nil?
  445.       @soundcategory_commandwindow.set_handler("Unaffiliated".to_sym, method(:deactivate_soundcategory_window))
  446.     end
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # * Set Sound Command Handlers
  450.   #--------------------------------------------------------------------------
  451.   def set_soundcommand_window_handlers
  452.     @soundfiles_hash.each_key do |category|
  453.       @soundfiles_hash[category].each_key do |key_name|
  454.         @sound_select_cmmdwindows[category].set_handler(key_name.to_sym, method(:deactivate_soundcommand_window))
  455.       end
  456.     end
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # * Set SoundPlay Handlers
  460.   #--------------------------------------------------------------------------
  461.   def set_soundplay_window_handlers
  462.     @sound_play_cmmdwindow.set_handler(:play_sound, method(:playsound_command))
  463.     @sound_play_cmmdwindow.set_handler(:volume,     method(:playsound_at_volume))
  464.     @sound_play_cmmdwindow.set_handler(:pitch,      method(:playsound_at_pitch))     if EnablePositionCommand
  465.     @sound_play_cmmdwindow.set_handler(:position,   method(:playsound_at_position))
  466.   end
  467.   #--------------------------------------------------------------------------
  468.   # * Create Help Window
  469.   #--------------------------------------------------------------------------
  470.   def create_help_window()
  471.     # Setting up Help Window
  472.     @help_window = Window_Help.new()
  473.     @help_window.set_text(CategorySelectHelpWindowTextLine1 + "\n" + CategorySelectHelpWindowTextLine2)
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # * Create SoundInfo Window
  477.   #--------------------------------------------------------------------------
  478.   def create_soundinfo_window()
  479.     # Setting up Sound Info Window
  480.     @sound_info_window_defaultY = @sound_play_cmmdwindow.y + @sound_play_cmmdwindow.height
  481.     @sound_info_window = Window_SoundInfo.new()
  482.     @sound_info_window.x = Graphics.width * 0.5
  483.     @sound_info_window.y = @sound_info_window_defaultY
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # * Create NumberInput Window
  487.   #--------------------------------------------------------------------------
  488.   def create_numberinput_window()
  489.     # Setting Up Number Input
  490.     @numberinput_window = Window_SoundTest_NumberInput.new()
  491.     @numberinput_window.z = 200
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # * Set Input Variables
  495.   #--------------------------------------------------------------------------
  496.   def set_input_variables()
  497.     @user_currently_inputting_value     = false
  498.     @currently_entering_volume_value    = false
  499.     @currently_entering_pitch_value     = false
  500.     @currently_entering_position_value  = false
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # * Setup Scene Intro Animation
  504.   #--------------------------------------------------------------------------
  505.   def setup_scene_intro_animation()
  506.     @album_art_hash[DefaultBackgroundSpriteFilename].opacity  = 0     unless @album_art_hash[DefaultBackgroundSpriteFilename].nil?
  507.     @soundcategory_commandwindow.opacity                      = 0
  508.     @sound_select_cmmdwindows[get_first_category()].x        -= 500
  509.     @sound_play_cmmdwindow.x                                 += 600
  510.     @help_window.y                                           -= 400
  511.     @sound_info_window.y                                     += 300
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # * Animate Intro Sequence
  515.   #--------------------------------------------------------------------------
  516.   def animate_intro_scene()
  517.     while( true )
  518.       bool1 = animate_sceneintro_background_image()
  519.       bool2 = animate_sceneintro_soundcategorycmmdwindow()
  520.       bool3 = animate_sceneintro_soundselectcmmdwindow()
  521.       bool4 = animate_sceneintro_soundplaycmmdwindow()
  522.       bool5 = animate_sceneintro_helpwindow()
  523.       bool6 = animate_sceneintro_soundinfowindow()
  524.       Graphics.update()
  525.       break if bool1 && bool2 && bool3 && bool4 && bool5 && bool6
  526.     end
  527.   end
  528.   #--------------------------------------------------------------------------
  529.   # * Animate BackgroundImage Opacity for Intro Sequence
  530.   #--------------------------------------------------------------------------
  531.   def animate_sceneintro_background_image()
  532.     return true if @album_art_hash[DefaultBackgroundSpriteFilename].nil?
  533.     return true if @album_art_hash[DefaultBackgroundSpriteFilename].opacity == 255
  534.     @album_art_hash[DefaultBackgroundSpriteFilename].opacity += 5
  535.     return false
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # * Animate SoundCategoryCommand Window for Intro Sequence
  539.   #--------------------------------------------------------------------------
  540.   def animate_sceneintro_soundcategorycmmdwindow()
  541.     return true if @soundcategory_commandwindow.opacity == 255
  542.     @soundcategory_commandwindow.opacity += 4
  543.     return false
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # * Animate SoundSelectCommand Window for Intro Sequence
  547.   #--------------------------------------------------------------------------
  548.   def animate_sceneintro_soundselectcmmdwindow()
  549.     return true if @sound_select_cmmdwindows[get_first_category()].x == 0
  550.     @sound_select_cmmdwindows[get_first_category()].x += 20
  551.     return false
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # * Animate SoundPlayCommand Window for Intro Sequence
  555.   #--------------------------------------------------------------------------
  556.   def animate_sceneintro_soundplaycmmdwindow()
  557.     return true if @sound_play_cmmdwindow.x == (Graphics.width * 0.5)
  558.     @sound_play_cmmdwindow.x -= 20
  559.     return false
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # * Animate Help Window for Intro Sequence
  563.   #--------------------------------------------------------------------------
  564.   def animate_sceneintro_helpwindow()
  565.     return true if @help_window.y == 0
  566.     @help_window.y += 10
  567.     return false
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # * Animate Sound Info Window
  571.   #--------------------------------------------------------------------------
  572.   def animate_sceneintro_soundinfowindow()
  573.     return true if @sound_info_window.y == @sound_info_window_defaultY
  574.     @sound_info_window.y -= 6
  575.     return false
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # * Deactivate Sound Command Windows
  579.   #--------------------------------------------------------------------------
  580.   def deactivate_soundcommand_windows()
  581.     @sound_select_cmmdwindows[get_category()].deactivate()
  582.     @sound_play_cmmdwindow.deactivate()
  583.     @soundcategory_commandwindow.deactivate()
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # * Deactivate Sound Category Command Window
  587.   #--------------------------------------------------------------------------
  588.   def deactivate_soundcategory_window()
  589.     @sound_select_cmmdwindows[get_category()].activate()
  590.     @soundcategory_commandwindow.deactivate()
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # * Deactivate Sound Command Window
  594.   #--------------------------------------------------------------------------
  595.   def deactivate_soundcommand_window(activate_play_window = true)
  596.     @sound_select_cmmdwindows[get_category()].deactivate()
  597.     if activate_play_window
  598.       @sound_play_cmmdwindow.activate()
  599.     else
  600.       @soundcategory_commandwindow.activate()
  601.     end
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * Deactivate SoundSelect Command Window
  605.   #--------------------------------------------------------------------------
  606.   def deactivate_soundselectcommand_window()
  607.     @sound_select_cmmdwindows[get_category()].activate()
  608.     @sound_play_cmmdwindow.deactivate()
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # * Deactivate SoundPlay Command Window
  612.   #--------------------------------------------------------------------------
  613.   def deactivate_soundplaycommand_window()
  614.     @sound_select_cmmdwindows[get_category()].activate()
  615.     @sound_play_cmmdwindow.deactivate()
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # * Update Sounds Command Visibility
  619.   #--------------------------------------------------------------------------
  620.   def update_sounds_visibility()
  621.     @sound_select_cmmdwindows.each_key do |category|
  622.       @sound_select_cmmdwindows[category].visible = (category == get_category())
  623.     end
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # * Update Info Window Text
  627.   #--------------------------------------------------------------------------
  628.   def update_window_info_text()
  629.     if @current_sound_symbol != @sound_select_cmmdwindows[get_category()].current_symbol
  630.       @current_sound_symbol = @sound_select_cmmdwindows[get_category()].current_symbol      
  631.       @sound_info_window.draw_text_soundinfo( @soundfiles_hash[get_category()][ @current_sound_symbol.to_s ].info_text )
  632.     end
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # * Update Album Art Image
  636.   #--------------------------------------------------------------------------
  637.   def update_album_art_image()
  638.     if @soundcategory_commandwindow.active
  639.       return if @album_art_hash[:current_image_name] == DefaultBackgroundSpriteFilename
  640.       unless @album_art_hash[DefaultBackgroundSpriteFilename].nil?
  641.         @album_art_hash[@album_art_hash[:current_image_name]].visible = false
  642.         @album_art_hash[:current_image_name] = DefaultBackgroundSpriteFilename
  643.         @album_art_hash[DefaultBackgroundSpriteFilename].visible = true
  644.       end
  645.      
  646.     else
  647.       filename = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].albumart_filename
  648.       if filename != @album_art_hash[:current_image_name]
  649.         filename = DefaultBackgroundSpriteFilename if filename == "" if @album_art_hash[@album_art_hash[:current_image_name]] != ""
  650.         return if filename == "" || filename == @album_art_hash[:current_image_name]
  651.         @album_art_hash[@album_art_hash[:current_image_name]].visible = false
  652.         @album_art_hash[:current_image_name] = filename
  653.         if @album_art_hash[filename].nil?
  654.           @album_art_hash[filename] = create_background_sprite(filename)
  655.         end
  656.         @album_art_hash[filename].visible = true
  657.       end
  658.     end
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # * Update Help Text
  662.   #--------------------------------------------------------------------------
  663.   def update_help_text()
  664.     # If SoundCategory Command Window is Active
  665.     if @soundcategory_commandwindow.active
  666.       @help_window.set_text(CategorySelectHelpWindowTextLine1 + "\n" + CategorySelectHelpWindowTextLine2)
  667.     # If SoundSelect Command Window is Active
  668.     elsif @sound_select_cmmdwindows[get_category()].active
  669.       @help_window.set_text(SoundSelectHelpWindowTextLine1 + "\n" + SoundSelectHelpWindowTextLine2)
  670.     # If NumberInput Window is Active
  671.     elsif @numberinput_window.active
  672.       @help_window.set_text(NumberInputHelpWindowTextLine1 + "\n" + NumberInputHelpWindowTextLine2)
  673.      # If Hovering Over PlaySound
  674.     elsif @sound_play_cmmdwindow.current_symbol == :play_sound
  675.       @help_window.set_text(PlaySoundOptionHelpWindowTextLine1 + "\n" + PlaySoundOptionHelpWindowTextLine2)
  676.      # If Hovering Over Volume Input
  677.     elsif @sound_play_cmmdwindow.current_symbol == :volume
  678.       @help_window.set_text(VolumeOptionHelpWindowTextLine1 + "\n" + VolumeOptionHelpWindowTextLine2)
  679.      # If Hovering Over Pitch Input
  680.     elsif @sound_play_cmmdwindow.current_symbol == :pitch
  681.       @help_window.set_text(PitchOptionHelpWindowTextLine1 + "\n" + PitchOptionHelpWindowTextLine2)
  682.      # If Hovering Over Position Input
  683.     else
  684.       @help_window.set_text(PositionOptionHelpWindowTextLine1 + "\n" + PositionOptionHelpWindowTextLine2)
  685.     end
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # * Update Scene Changes
  689.   #--------------------------------------------------------------------------
  690.   def update_scene_changes()
  691.     if Input.trigger?(:B)
  692.       Sound.play_cancel()
  693.       return_scene()                          if @soundcategory_commandwindow.active()
  694.       deactivate_soundcommand_window(false)   if @sound_select_cmmdwindows[get_category()].active
  695.       deactivate_soundplaycommand_window()    if @sound_play_cmmdwindow.active
  696.     end
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # * Update User Input
  700.   #--------------------------------------------------------------------------
  701.   def update_user_input()
  702.     if @user_currently_inputting_value && @numberinput_window.completed
  703.       receive_volume_value()    if @currently_entering_volume_value
  704.       receive_pitch_value()     if @currently_entering_pitch_value
  705.       receive_position_value()  if @currently_entering_position_value  
  706.     end
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # * Play Sound Command
  710.   #--------------------------------------------------------------------------
  711.   def playsound_command()
  712.     @soundfiles_hash[get_category()][@current_sound_symbol.to_s].default_play()    
  713.     @sound_play_cmmdwindow.activate()
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # * Play Sound 'At Volume' Command
  717.   #--------------------------------------------------------------------------
  718.   def playsound_at_volume()
  719.     deactivate_soundcommand_windows()
  720.     @user_currently_inputting_value = true
  721.     @currently_entering_volume_value = true
  722.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].volume
  723.     @numberinput_window.start( number, 3 )
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # * Play Sound 'At Pitch' Command
  727.   #--------------------------------------------------------------------------
  728.   def playsound_at_pitch()
  729.     deactivate_soundcommand_windows()
  730.     @user_currently_inputting_value = true
  731.     @currently_entering_pitch_value = true
  732.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].pitch
  733.     @numberinput_window.start( number, 3 )
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # * Play Sound 'At Position' Command
  737.   #--------------------------------------------------------------------------
  738.   def playsound_at_position()
  739.     @currently_entering_position_value = true
  740.     @user_currently_inputting_value = true
  741.     deactivate_soundcommand_windows()
  742.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].position
  743.     @numberinput_window.start( number, 9 )
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # * Receive Volume Value
  747.   #--------------------------------------------------------------------------
  748.   def receive_volume_value()
  749.     if @numberinput_window.processed_ok
  750.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].volume = @numberinput_window.result
  751.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play()
  752.     end
  753.     @sound_play_cmmdwindow.activate()
  754.     set_input_variables()
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # * Receive Pitch Value
  758.   #--------------------------------------------------------------------------
  759.   def receive_pitch_value()
  760.     if @numberinput_window.processed_ok
  761.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].pitch = @numberinput_window.result
  762.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play()
  763.     end
  764.     @sound_play_cmmdwindow.activate()
  765.     set_input_variables()
  766.   end
  767.   #--------------------------------------------------------------------------
  768.   # * Receive Position Value
  769.   #--------------------------------------------------------------------------
  770.   def receive_position_value()
  771.     if @numberinput_window.processed_ok
  772.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play_at_position( @numberinput_window.result )
  773.     end
  774.     @sound_play_cmmdwindow.activate()
  775.     set_input_variables()
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # * Check if Valid Category
  779.   #--------------------------------------------------------------------------
  780.   def check_if_valid_category(category)
  781.     return Music_Categories.include?(category)
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # * Get Category Text
  785.   #--------------------------------------------------------------------------
  786.   def get_category()
  787.     return @soundcategory_commandwindow.current_symbol.to_s
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # * Get First Category Text
  791.   #--------------------------------------------------------------------------
  792.   def get_first_category()
  793.     return @soundcategory_commandwindow.get_first_command_name
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # * Is Valid Scene?
  797.   #--------------------------------------------------------------------------
  798.   def is_valid_scene?()
  799.     return !@soundfiles_hash.empty?
  800.   end
  801. end
  802.  
  803.  
  804. if DiamondandPlatinum3::SoundTestScene::EnableMenuOption
  805.   #==============================================================================
  806.   # ** Window_MenuCommand
  807.   #------------------------------------------------------------------------------
  808.   #  This command window appears on the menu screen.
  809.   #==============================================================================
  810.    
  811.   class Window_MenuCommand < Window_Command
  812.     #--------------------------------------------------------------------------
  813.     # * Add Exit Game to Command List
  814.     #--------------------------------------------------------------------------
  815.     alias dp3_soundtestscene_windowmenucommd_addgameendcmmd_ofa     add_game_end_command
  816.     #--------------------------------------------------------------------------
  817.     def add_game_end_command
  818.       enabled = (DiamondandPlatinum3::SoundTestScene::EnableSwitchID > 0) ? $game_switches[DiamondandPlatinum3::SoundTestScene::EnableSwitchID] : true
  819.       add_command(DiamondandPlatinum3::SoundTestScene::MenuCommandText, :dp3_sound_test, enabled)
  820.      
  821.       dp3_soundtestscene_windowmenucommd_addgameendcmmd_ofa() # Call Original Method
  822.     end
  823.   end
  824.    
  825.    
  826.    
  827.   #==============================================================================
  828.   # ** Scene_Menu
  829.   #------------------------------------------------------------------------------
  830.   #  This class performs the menu screen processing.
  831.   #==============================================================================
  832.    
  833.   class Scene_Menu < Scene_MenuBase
  834.     #--------------------------------------------------------------------------
  835.     # * Create Command Window
  836.     #--------------------------------------------------------------------------
  837.     alias dp3_soundtestscene_scenemenu_creatcmmdwind_ofa      create_command_window
  838.     #--------------------------------------------------------------------------
  839.     def create_command_window
  840.       dp3_soundtestscene_scenemenu_creatcmmdwind_ofa() # Call original Method  
  841.       @command_window.set_handler(:dp3_sound_test,    method(:command_soundtest))
  842.     end
  843.     #--------------------------------------------------------------------------
  844.     # * Command Sound Test
  845.     #--------------------------------------------------------------------------
  846.     def command_soundtest
  847.       SceneManager.call(Scene_SoundTest)
  848.     end
  849.   end
  850.  
  851. end
  852.  
  853.  
  854.  
  855. #==============================================================================
  856. # ** SoundCategory_Command
  857. #------------------------------------------------------------------------------
  858. # The Command Window that is used when selecting a sound category
  859. #==============================================================================
  860.  
  861. class Window_SoundTest_SoundCategoryCommand < Window_Command
  862.   #--------------------------------------------------------------------------
  863.   # * Get Window Width
  864.   #--------------------------------------------------------------------------
  865.   def window_width
  866.     return Graphics.width
  867.   end
  868.   #--------------------------------------------------------------------------
  869.   # * Get Digit Count
  870.   #--------------------------------------------------------------------------
  871.   def col_max
  872.     return DiamondandPlatinum3::SoundTestScene::MaxCategoryHorizontalCommands
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # * Get Number of Lines to Show
  876.   #--------------------------------------------------------------------------
  877.   def visible_line_number
  878.     return (SceneManager.scene.instance_variable_get('@soundfiles_hash').size.to_f / col_max).ceil
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # * Get Spacing for Items Arranged Side by Side
  882.   #--------------------------------------------------------------------------
  883.   def spacing
  884.     return 4
  885.   end
  886.   #--------------------------------------------------------------------------
  887.   # * Get First Command Name
  888.   #--------------------------------------------------------------------------
  889.   def get_first_command_name()
  890.     return @list[0][:name]
  891.   end
  892.   #--------------------------------------------------------------------------
  893.   # * Make Command List
  894.   #--------------------------------------------------------------------------
  895.   def make_command_list
  896.     soundfiles_hash = SceneManager.scene.instance_variable_get('@soundfiles_hash')
  897.     DiamondandPlatinum3::SoundTestScene::Music_Categories.each do |category|    
  898.       add_command(category, category.to_sym) if !soundfiles_hash[category].nil?
  899.     end
  900.     command = "Unaffiliated"
  901.     add_command(command, command.to_sym) if !soundfiles_hash[command].nil?
  902.   end  
  903. end
  904.  
  905.  
  906. #==============================================================================
  907. # ** SoundTest_Command
  908. #------------------------------------------------------------------------------
  909. # The Command Window that is used when selecting a sound
  910. #==============================================================================
  911.  
  912. class Window_SoundTest_SoundCommand < Window_Command
  913.   #--------------------------------------------------------------------------
  914.   # * Initialize
  915.   #--------------------------------------------------------------------------
  916.   attr_reader :category
  917.   def initialize(*args, a_category)
  918.     @category = a_category
  919.     super(*args)
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # * Get Window Width
  923.   #--------------------------------------------------------------------------
  924.   def window_width
  925.     return Graphics.width * 0.5
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # * Make Command List
  929.   #--------------------------------------------------------------------------
  930.   def make_command_list
  931.     sounds_hash = SceneManager.scene.instance_variable_get('@soundfiles_hash')
  932.     sounds_hash[@category].each_key do |key_name|    
  933.       add_command(sounds_hash[@category][key_name].name, key_name.to_sym)
  934.     end
  935.   end  
  936. end
  937.  
  938.  
  939. #==============================================================================
  940. # ** PlaySound_Command
  941. #------------------------------------------------------------------------------
  942. # The Command Window that is used for playing a sound
  943. #==============================================================================
  944.  
  945. class Window_SoundTest_PlayCommand < Window_Command
  946.   #--------------------------------------------------------------------------
  947.   # * Get Window Width
  948.   #--------------------------------------------------------------------------
  949.   def window_width
  950.     return Graphics.width * 0.5
  951.   end
  952.   #--------------------------------------------------------------------------
  953.   # * Make Command List
  954.   #--------------------------------------------------------------------------
  955.   def make_command_list
  956.     add_command("Play Sound", :play_sound)
  957.     add_command("Volume",     :volume)
  958.     add_command("Pitch",      :pitch)
  959.     add_command("Position",   :position)    if DiamondandPlatinum3::SoundTestScene::EnablePositionCommand
  960.   end  
  961. end
  962.  
  963.  
  964.  
  965.  
  966. #==============================================================================
  967. # ** Window_SoundInfo
  968. #------------------------------------------------------------------------------
  969. #  This message window is used to display Sound Information
  970. #==============================================================================
  971.  
  972. class Window_SoundInfo < Window_Base
  973.   #--------------------------------------------------------------------------
  974.   # * Object Initialization
  975.   #--------------------------------------------------------------------------
  976.   def initialize
  977.     super(0, 0, window_width, window_height)
  978.     self.z = 200
  979.   end
  980.   #--------------------------------------------------------------------------
  981.   # * Set Font
  982.   #--------------------------------------------------------------------------
  983.   def set_font
  984.     contents.font.size = 18
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # * Get Window Width
  988.   #--------------------------------------------------------------------------
  989.   def window_width
  990.     return Graphics.width * 0.5
  991.   end
  992.   #--------------------------------------------------------------------------
  993.   # * Get Window Height
  994.   #--------------------------------------------------------------------------
  995.   def window_height
  996.     return Graphics.height - SceneManager.scene.instance_variable_get('@sound_info_window_defaultY')
  997.   end  
  998.   #--------------------------------------------------------------------------
  999.   # * Draw Text
  1000.   #--------------------------------------------------------------------------
  1001.   def draw_text_soundinfo(text)
  1002.     contents.clear
  1003.     set_font()
  1004.     draw_text_ex(0, 0, word_wrapping(text))
  1005.   end  
  1006.   #--------------------------------------------------------------------------
  1007.   # * Draw Text with Control Characters
  1008.   #--------------------------------------------------------------------------
  1009.   def draw_text_ex(x, y, text)
  1010.     text = convert_escape_characters(text)
  1011.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  1012.     until text.empty?
  1013.       c = text.slice!(0, 1)
  1014.       if c == "\n"
  1015.         pos[:x] = pos[:new_x]
  1016.         pos[:y] += pos[:height]
  1017.         pos[:height] = calc_line_height(text)
  1018.       else
  1019.         text_width = text_size(c).width
  1020.         draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  1021.         pos[:x] += text_width
  1022.       end
  1023.     end
  1024.   end
  1025.   #--------------------------------------------------------------------------
  1026.   # * Word Wrapping
  1027.   #--------------------------------------------------------------------------
  1028.   def word_wrapping(text, pos = 0)
  1029.    
  1030.     # Current Text Position
  1031.     current_text_position = 0    
  1032.    
  1033.     for i in 0..(text.length - 1)
  1034.       if text[i] == "\n"
  1035.         current_text_position = 0
  1036.         next
  1037.       end
  1038.      
  1039.       # Current Position += character width
  1040.       current_text_position += contents.text_size(text[i]).width
  1041.      
  1042.       # If Current Position > Window Width
  1043.       if (pos + current_text_position) >= (contents.width)
  1044.         # Then Format the Sentence to fit Line
  1045.         current_element = i
  1046.         while(text[current_element] != " ")
  1047.           break if current_element == 0
  1048.           current_element -= 1
  1049.         end
  1050.        
  1051.         temp_text = ""
  1052.         for j in 0..(text.length - 1)
  1053.           temp_text += text[j]
  1054.           temp_text += "\n" if j == current_element
  1055.         end
  1056.         text = temp_text
  1057.         i = current_element
  1058.         current_text_position = 0
  1059.       end
  1060.     end
  1061.     return text
  1062.   end
  1063. end
  1064.  
  1065.  
  1066.  
  1067. #==============================================================================
  1068. # ** Window_NumberInput
  1069. #------------------------------------------------------------------------------
  1070. #  This window is used for the event command [Input Number].
  1071. #==============================================================================
  1072.  
  1073. class Window_SoundTest_NumberInput < Window_NumberInput
  1074.   #--------------------------------------------------------------------------
  1075.   # * Public Instance Variables
  1076.   #--------------------------------------------------------------------------
  1077.   attr_reader :result       # The Result of User Input
  1078.   attr_reader :completed    # User Finished Input Processing?
  1079.   attr_reader :processed_ok # User Did not Cancel User Input?
  1080.   #--------------------------------------------------------------------------
  1081.   # * Initialize
  1082.   #--------------------------------------------------------------------------
  1083.   def initialize()
  1084.     super( self )
  1085.     @result       = 0
  1086.     @completed    = true
  1087.     @processed_ok = false
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # * Start Input Processing
  1091.   #--------------------------------------------------------------------------
  1092.   def start( number, digits )
  1093.     @digits_max = digits
  1094.     @number = number
  1095.     @index = 0
  1096.     @completed = false
  1097.     update_placement
  1098.     create_contents
  1099.     refresh
  1100.     open
  1101.     activate
  1102.   end
  1103.   #--------------------------------------------------------------------------
  1104.   # * Update Window Position
  1105.   #--------------------------------------------------------------------------
  1106.   def update_placement
  1107.     self.width = @digits_max * 20 + padding * 2
  1108.     self.height = fitting_height(1)
  1109.     self.x = (Graphics.width - width) * 0.5
  1110.     self.y = 192
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # * Processing When OK Button Is Pressed
  1114.   #--------------------------------------------------------------------------
  1115.   def process_ok
  1116.     Sound.play_ok
  1117.     @result = @number
  1118.     @completed = true
  1119.     @processed_ok = true
  1120.     deactivate
  1121.     close
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # * Processing When Cancel Button Is Pressed
  1125.   #--------------------------------------------------------------------------
  1126.   def process_cancel
  1127.     Sound.play_cancel
  1128.     @completed    = true
  1129.     @processed_ok = false
  1130.     deactivate
  1131.     close
  1132.   end
  1133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement