Holy87

Windowskin Options

Oct 19th, 2015 (edited)
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 23.33 KB | None | 0 0
  1. =begin
  2.  ==============================================================================
  3.   ■ Opzioni skin finestre di Holy87
  4.       versione 1.1
  5.       Difficoltà utente: ★★
  6.       Licenza: CC. Chiunque può scaricare, modificare, distribuire e utilizzare
  7.       lo script nei propri progetti, sia amatoriali che commerciali. Vietata
  8.       l'attribuzione impropria.
  9.  ==============================================================================
  10.     Questo script aggiunge al menu delle opzioni le impostazioni per i temi
  11.     personalizzati dei menu. Puoi:
  12.     - Inserire tutte le windowskin che vuoi in Graphics/Windowskins
  13.     - Permettere al giocatore di inserire temi custom in Documenti/Gioco/Skins
  14.     - Impostare tutte le proprietà della windowskin come font, trasparenza e
  15.       tonalità predefinita in un file di testo
  16.  ==============================================================================
  17.   ■ Compatibilità
  18.     Window_Base -> alias initialize
  19.  ==============================================================================
  20.   ■ Installazione e istruzioni
  21.     Installare questo script sotto Materials e prima del Main.
  22.  
  23.     ● Requisiti
  24.     RICHIEDE IL MENU DELLE OPZIONI DI GIOCO DI HOLY87 (1.2 o superiore)
  25.     http://pastebin.com/raw.php?i=qmq1qpdV
  26.     Se vuoi fare in modo che il giocatore possa inserire le windowskin
  27.     personalizzate nella sua cartella utente, hai bisogno anche dello script
  28.     dei salvataggi nei documenti:
  29.     https://holy87.wordpress.com/2015/08/12/savegame-in-my-documents/
  30.  
  31.     ● Istruzioni di base
  32.     Crea una cartella Windowskins nella cartella Graphics del tuo progetto.
  33.     Inserisci tutte le windowskin che vuoi.
  34.     Puoi personalizzare ulteriormente la winowskin impostandone la trasparenza,
  35.     la tonalità predefinita, il/i font, grandezza font, tipo (grassetto, corsivo)
  36.     ombra, contorno ecc...
  37.  
  38.     ● Personalizzazione windowskin
  39.     Se vuoi personalizzare nel dettaglio la skin, ecco cosa devi fare:
  40.     - Crea un documento di testo nella cartella Windowskins con lo stesso
  41.       nome del file. Ad esempio, se la skin si chiama Window.png, il file
  42.       deve chiamarsi Window.txt
  43.     - Scrivi all'interno del file gli attributi su ogni riga. Gli attributi
  44.       che puoi scrivere sono i seguenti:
  45.  
  46.       name: Nuovo nome
  47.       per assegnare un nome della finestra diverso dal nome del file
  48.  
  49.       fonts: Arial, Verdana, Elvetica
  50.       Assegna un font diverso da quello di default per questo tema. Puoi mettere
  51.       più font separati da virgola in modo che se nel computer non è installato
  52.       quel determinato font, potrai utilizzare il successivo.
  53.  
  54.       bold: true
  55.       Imposta il font in grassetto quando è attivato questo tema.
  56.  
  57.       italic: true
  58.       Imposta il font in corsivo quando è attivato questo tema.
  59.  
  60.       font size: x
  61.       Impsota la grandezza del carattere a x
  62.  
  63.       outline: false
  64.       Elimina il contorno del testo
  65.  
  66.       shadow: true
  67.       Aggiunge l'ombra al testo (come in RPG Maker MV)
  68.  
  69.       opacity: x
  70.       Imposta l'opacità dello sfondo finestra da 0 a 255 (192 di default)
  71.  
  72.       tone: X,Y,Z
  73.       Imposta una tonalità personalizzata della finestra, dove X, Y e Z sono
  74.       rispettivamente i colori rosso, verde e blu (da -255 a 255)
  75.  
  76.       tone locked: true
  77.       Blocca il cambio di tonalità per questo tema. L'utente non può cambiare
  78.       tonalità della windowskin
  79.  
  80.       background: x
  81.       Imposta uno sfondo (nella cartella Picture) quando si seleziona questa
  82.       windowskin.
  83.  
  84.       outline color: A,B,C,D
  85.       Imposta un colore del contorno dove A: Colore rosso, B: Verde, C: Blu,
  86.       D: Trasparenza. Quest'ultimo è facoltativo.
  87.  ==============================================================================
  88. =end
  89.  
  90. #==============================================================================
  91. # ** CONFIGURAZIONE
  92. #==============================================================================
  93. module WindowskinsManager
  94.   # Imposta la finestra predefinita all'avvio del gioco
  95.   DEFAULT_SKIN = "Stripes"
  96.   # Vuoi aggiungere la cartella delle windowskins custom in Documenti?
  97.   USE_CUSTOM = true #false se non vuoi questa funzione
  98.   # Nome della cartella
  99.   INT_SK_FOLDER = "Graphics/Windowskins"
  100.   EXT_SK_FOLDER = "Skins"
  101.   # Stringhe di testo nelle opzioni
  102.   SET_HELP = "Imposta un tema delle finestre personalizzato."
  103.   SET_TEXT = "Tema"
  104.   SET_REDC = "Rosso"
  105.   SET_REDH = "Cambia la tonalità di rosso dello sfondo."
  106.   SET_GREE = "Verde"
  107.   SET_GREH = "Cambia la tonalità di verde dello sfondo."
  108.   SET_BLUE = "Blu"
  109.   SET_BLUH = "Cambia la tonalità di blu dello sfondo."
  110. end
  111.  
  112. # --- --- --- --- --- --- FINE DELLA CONFIGURAZIONE --- --- --- --- --- ---
  113. #    Non modificare oltre questo script se non sai dove mettere le mani.
  114.  
  115.  
  116. $imported = {} if $imported == nil
  117. $imported["H87_Windowskins"] = 1.1
  118. unless $imported["H87_Options"]
  119.   msgbox "Windowskins script requires Holy87 Settings Menu v1.2.0 or better."
  120. end
  121. #==============================================================================
  122. # ** WindowskinsManager
  123. #------------------------------------------------------------------------------
  124. #  Handles the windowskins list
  125. #==============================================================================
  126. module WindowskinsManager
  127.   module_function
  128.   # Returns the windows folder name
  129.   def window_folder
  130.     EXT_SK_FOLDER;
  131.   end
  132.  
  133.   # Gets the list of all windowskins objects
  134.   def list
  135.     default_windowskins.merge(user_windowskins)
  136.   end
  137.  
  138.   # An hash with all the windowskin names {"name" => "name"}
  139.   def name_list
  140.     h = {}
  141.     list.keys.each { |key| h[key] = key }
  142.     h
  143.   end
  144.  
  145.   # Gets all the default windowskins in the game folder
  146.   def default_windowskins
  147.     fetch_windowskin_folder(INT_SK_FOLDER)
  148.   end
  149.  
  150.   # Gets all the custom windowskins in user folder
  151.   def user_windowskins
  152.     return {} unless $imported['H87_Homesave']
  153.     return {} unless USE_CUSTOM
  154.     fetch_windowskin_folder(custom_windowskins_folder)
  155.   end
  156.  
  157.   # Searches for all windowskins in the folder
  158.   # @param [String] path
  159.   # @return [Hash]
  160.   def fetch_windowskin_folder(path)
  161.     windowskins = {}
  162.     Dir.foreach(path) do |file_name|
  163.       next if file_name == "." || file_name == '..'
  164.       file = path + "/" + file_name
  165.       next if File.directory?(file)
  166.       next unless File.extname(file).downcase == '.png'
  167.       ws = Window_Skin.new(file)
  168.       windowskins[ws.name] = ws
  169.     end
  170.     windowskins
  171.   end
  172.  
  173.   # Returns the complete folder path
  174.   # noinspection RubyResolve
  175.   # @return [String]
  176.   def custom_windowskins_folder
  177.     fpath = Homesave.project_data_directory + '/' + window_folder
  178.     Dir.mkdir(fpath) unless File.directory?(fpath)
  179.     fpath
  180.   end
  181.  
  182.   # Adds the skin options in the settings menu
  183.   def set_options
  184.     H87Options.push_appearance_option(window_hash)
  185.     H87Options.push_appearance_option(red_hash)
  186.     H87Options.push_appearance_option(green_hash)
  187.     H87Options.push_appearance_option(blue_hash)
  188.   end
  189.  
  190.   # Gets the windowskin selection hash
  191.   # @return [Hash]
  192.   def window_hash
  193.     {
  194.         :type => :variable,
  195.         :var => 0,
  196.         :text => SET_TEXT,
  197.         :help => SET_HELP,
  198.         :val_mt => :get_windowskin,
  199.         :method => :set_windowskin,
  200.         :values => name_list,
  201.         :popup => "Window_SkinPopup"
  202.     }
  203.   end
  204.  
  205.   # Gets the red color selection hash
  206.   # @return [Hash]
  207.   def red_hash
  208.     {
  209.         :type => :bar,
  210.         :text => SET_REDC,
  211.         :help => SET_REDH,
  212.         :var => 0,
  213.         :max => 255,
  214.         :min => -255,
  215.         :color => Color.new(255, 0, 0),
  216.         :perc => false,
  217.         :not_initialize => true,
  218.         :condition => "$game_system.tone_allowed?",
  219.         :val_mt => :get_red_tone,
  220.         :method => :set_red_tone}
  221.   end
  222.  
  223.   # Gets the gren color selection hash
  224.   # @return [Hash]
  225.   def green_hash
  226.     {
  227.         :type => :bar,
  228.         :text => SET_GREE,
  229.         :help => SET_GREH,
  230.         :var => 0,
  231.         :max => 255,
  232.         :min => -255,
  233.         :color => Color.new(0, 255, 0),
  234.         :perc => false,
  235.         :not_initialize => true,
  236.         :condition => "$game_system.tone_allowed?",
  237.         :val_mt => :get_green_tone,
  238.         :method => :set_green_tone}
  239.   end
  240.  
  241.   # Gets the blue color selection hash
  242.   # @return [Hash]
  243.   def blue_hash
  244.     {
  245.         :type => :bar,
  246.         :text => SET_BLUE,
  247.         :help => SET_BLUH,
  248.         :var => 0,
  249.         :max => 255,
  250.         :min => -255,
  251.         :color => Color.new(0, 0, 255),
  252.         :perc => false,
  253.         :not_initialize => true,
  254.         :condition => "$game_system.tone_allowed?",
  255.         :val_mt => :get_blue_tone,
  256.         :method => :set_blue_tone}
  257.   end
  258. end
  259.  
  260. #==============================================================================
  261. # ** Window_Skin
  262. #------------------------------------------------------------------------------
  263. #  Class that handles all windowskin informations
  264. #==============================================================================
  265. class Window_Skin
  266.   # Public instance variables
  267.   # @return [String]
  268.   attr_reader :path #file path
  269.   # @return [String]
  270.   attr_reader :name #windowskin name
  271.   # @return [Tone]
  272.   attr_reader :tone #windowskin color
  273.   attr_reader :bold #text bold
  274.   attr_reader :italic #text italic
  275.   attr_reader :outline #text outline
  276.   attr_reader :opacity #text opacity
  277.   attr_reader :shadow #text shadow
  278.   # @return [String or Array<String>]
  279.   attr_reader :font_name #fonts array
  280.   # @return [String]
  281.   attr_reader :file_name #file name
  282.   attr_reader :font_size #text size
  283.   # @return [Color]
  284.   attr_reader :font_color #font color
  285.   # @return [Color]
  286.   attr_reader :font_out_color #outline color
  287.   # @return [String]
  288.   attr_reader :background #background image
  289.   attr_reader :tone_locked #tone locked?
  290.   # Object initialization
  291.   #   path: file path
  292.   def initialize(path)
  293.     @path = File.dirname(path) + "/"
  294.     @file_name = File.basename(path, ".*")
  295.     @name = @file_name
  296.     @font_color = text_color
  297.     check_skin_settings
  298.   end
  299.  
  300.   # Check if a skin setting file exists
  301.   def check_skin_settings
  302.     settings_file = @path + @file_name + ".txt"
  303.     if File.exist?(settings_file)
  304.       fetch_skin_settings(settings_file)
  305.     end
  306.   end
  307.  
  308.   # Reads the settings file and settes the proper parameters
  309.   #   settings_file: Settings file to read
  310.   def fetch_skin_settings(settings_file)
  311.     File.open(settings_file, "r") do |file|
  312.       file.each_line do |line|
  313.         case line
  314.         when /name[ ]*[=:][ ]*(.+)/i;
  315.           @name = $1
  316.         when /bold[ ]*[=:][ ]*(.+)/i;
  317.           @bold = ch_tf($1)
  318.         when /italic[ ]*[=:][ ]*(.+)/i;
  319.           @italic = ch_tf($1)
  320.         when /outline[ ]*[=:][ ]*(.+)/i;
  321.           @outline = ch_tf($1)
  322.         when /shadow[ ]*[=:][ ]*(.+)/i;
  323.           @shadow = ch_tf($1)
  324.         when /tone locked[ ]*[=:][ ]*(.+)/i;
  325.           @tone_locked = ch_tf($1)
  326.         when /fonts[ ]*[=:][ ]*(.+)/i;
  327.           @font_name = $1.split(",")
  328.         when /font size[ ]*[=:][ ]*(\d+)/i;
  329.           @font_size = $1.to_i
  330.         when /opacity[ ]*[=:][ ]*(\d+)/i;
  331.           @opacity = $1.to_i
  332.         when /background[ ]*[=:][ ]*(.+)/i;
  333.           @background = $1
  334.         when /^color[ ]*[=:][ ]*(.+)/i
  335.           colors = $1.split(/[ ]*,[ ]*/)
  336.           @font_color = Color.new(255, 255, 255, 255)
  337.           @font_color.red = colors[0].to_i if colors[0]
  338.           @font_color.green = colors[1].to_i if colors[1]
  339.           @font_color.blue = colors[2].to_i if colors[2]
  340.           @font_color.alpha = colors[3].to_i if colors[3]
  341.         when /^outline color[ ]*[=:][ ]*(.+)/i
  342.           colors = $1.split(/[ ]*,[ ]*/)
  343.           @font_out_color = Color.new(0, 0, 0, 255)
  344.           @font_out_color.red = colors[0].to_i if colors[0]
  345.           @font_out_color.green = colors[1].to_i if colors[1]
  346.           @font_out_color.blue = colors[2].to_i if colors[2]
  347.           @font_out_color.alpha = colors[3].to_i if colors[3]
  348.         when /tone[ ]*[=:][ ]*(.+)/i
  349.           begin
  350.             colors = $1.split(/[ ]*,[ ]*/).collect { |a| a.to_i }
  351.             @tone = Tone.new(colors[0], colors[1], colors[2])
  352.           rescue Exception
  353.             Logger.error $!
  354.             Logger.error $!.message
  355.           end
  356.         else
  357.           puts 'Invalid ' + line + ' data'
  358.         end
  359.       end
  360.     end
  361.   end
  362.  
  363.   # Returns true or false for a proper string
  364.   #   string: string to read. Returns true if string == "true",
  365.   #                           Returns false if string == "false",
  366.   #                           Otherwise, returns nil.
  367.   def ch_tf(string)
  368.     if string =~ /(true|false)/i
  369.       return true if string.downcase == "true"
  370.       return false if string.downcase == "false"
  371.     end
  372.     nil
  373.   end
  374.  
  375.   # Returns the windowskin bitmap
  376.   # @return [Bitmap]
  377.   def bitmap
  378.     Cache.windowskin(@file_name, @path);
  379.   end
  380.  
  381.   # Get Text Color
  382.   #     n : Text color number  (0-31)
  383.   # @param [Integer] n
  384.   # @return [Color]
  385.   def text_color(n = 0)
  386.     x = 64 + (n % 8) * 8
  387.     y = 96 + (n / 8) * 8
  388.     bitmap.get_pixel(x, y)
  389.   end
  390. end
  391.  
  392. #==============================================================================
  393. # ** Cache
  394. #------------------------------------------------------------------------------
  395. #  Module for loading resources
  396. #==============================================================================
  397. module Cache
  398.   # Returns the windowskin bitmap
  399.   def self.windowskin(filename, path = WindowskinsManager::INT_SK_FOLDER + '/')
  400.     load_bitmap(path, filename)
  401.   end
  402. end
  403.  
  404. #==============================================================================
  405. # ** Game_System
  406. #==============================================================================
  407. class Game_System
  408.   attr_accessor :tone_customized
  409.   # Returns the selected windowskin or default if none is setted
  410.   # @return [Window_Skin]
  411.   def selected_windowskin
  412.     set_windowskin(default_windowskin) if @selected_windowskin.nil?
  413.     @selected_windowskin
  414.   end
  415.  
  416.   # Returns the default widnowskin
  417.   # @return [Window_Skin]
  418.   def default_windowskin
  419.     Window_Skin.new(WindowskinsManager::INT_SK_FOLDER + '/' + WindowskinsManager::DEFAULT_SKIN)
  420.   end
  421.  
  422.   # Sets a windowskin to the game
  423.   #   skin_name: if it's a string, sets the windowskin of the list from key
  424.   #              if it's an integer or nil, sets the default windowskin
  425.   #              if it's a Window_Skin object, sets that windowskin
  426.   # @param [String or Window_Skin] skin_name
  427.   def set_windowskin(skin_name)
  428.     if skin_name == 0 or skin_name.nil?
  429.       windowskin = default_windowskin
  430.     elsif skin_name.is_a?(Window_Skin)
  431.       windowskin = skin_name
  432.     else
  433.       windowskin = WindowskinsManager.list[skin_name]
  434.     end
  435.     if windowskin.nil?
  436.       puts "Nessuna Windowskin per #{skin_name}"
  437.       return
  438.     end
  439.     @selected_windowskin = windowskin
  440.     if windowskin.tone != nil
  441.       @backup_tone = self.window_tone.clone if @tone_customized
  442.       self.window_tone = windowskin.tone
  443.       @tone_customized = false
  444.     else
  445.       if @backup_tone != nil
  446.         self.window_tone = @backup_tone
  447.         @backup_tone = nil
  448.       else
  449.         self.window_tone = $data_system.window_tone if $data_system
  450.       end
  451.     end
  452.     update_font_settings
  453.   end
  454.  
  455.   # Refreshes the windowskin as the save loads
  456.   def refresh_windowskin
  457.     set_windowskin(selected_windowskin)
  458.   end
  459.  
  460.   # Change the font settings setted in the windowskin.
  461.   def update_font_settings
  462.     change_font_setting(:default_name, :font_name)
  463.     change_font_setting(:default_size, :font_size)
  464.     change_font_setting(:default_bold, :bold)
  465.     change_font_setting(:default_italic, :italic)
  466.     change_font_setting(:default_shadow, :shadow)
  467.     change_font_setting(:default_outline, :outline)
  468.     change_font_setting(:default_color, :font_color)
  469.     change_font_setting(:default_out_color, :font_out_color)
  470.   end
  471.  
  472.   # Change the specified font setting.
  473.   #   f_param: Font class attribute
  474.   #   w_param: Window_Skin class proper attribute
  475.   #   If w_param is nil, loads the default font setting.
  476.   # @param [Symbol] f_param font param
  477.   # @param [Symbol] w_param windowskin param
  478.   def change_font_setting(f_param, w_param)
  479.     default_param = (f_param.to_s + '=').to_sym
  480.     value = selected_windowskin.send(w_param)
  481.     if value.is_a?(Color) or value != nil
  482.       Font.send(default_param, selected_windowskin.send(w_param))
  483.     else
  484.       Font.send(default_param, Font_BK.send(f_param))
  485.     end
  486.   end
  487.  
  488.   # Returns true if the player can change the windowskin tone
  489.   def tone_allowed?
  490.     !selected_windowskin.tone_locked
  491.   end
  492.  
  493.   # resets windowskin settings if windowskin not found
  494.   def fallback_windowskin
  495.     return if WindowskinsManager.list.keys.include?(selected_windowskin.name)
  496.     set_windowskin default_windowskin
  497.   end
  498. end
  499.  
  500. #==============================================================================
  501. # ** Window_SkinPopup
  502. #------------------------------------------------------------------------------
  503. #  Window for windowskin selection
  504. #==============================================================================
  505. class Window_SkinPopup < Generic_PopupWindow
  506.   # Override method for cursor up
  507.   def cursor_up(wrap = false)
  508.     super(wrap)
  509.     update_skins
  510.   end
  511.  
  512.   # Override method for curson down
  513.   def cursor_down(wrap = false)
  514.     super(wrap)
  515.     update_skins
  516.   end
  517.  
  518.   # Update the system windowskin for all windows
  519.   def update_skins
  520.     $game_system.set_windowskin(item)
  521.     SceneManager.scene.change_skin
  522.     refresh_windowskin(true)
  523.   end
  524. end
  525.  
  526. #==============================================================================
  527. # ** Scene_Options
  528. #------------------------------------------------------------------------------
  529. #  Adds the method to refresh all windows
  530. #==============================================================================
  531. class Scene_Options < Scene_MenuBase
  532.   # Change scene windowskin
  533.   def change_skin
  534.     reset_skins
  535.     set_background2_bitmap
  536.   end
  537.  
  538.   # Refresh all windows skins
  539.   def reset_skins
  540.     instance_variables.each do |varname|
  541.       ivar = instance_variable_get(varname)
  542.       ivar.refresh_windowskin(true) if ivar.is_a?(Window)
  543.     end
  544.   end
  545. end
  546.  
  547. #==============================================================================
  548. # ** Option
  549. #------------------------------------------------------------------------------
  550. #  New option methods
  551. #==============================================================================
  552. class Option
  553.   # Get the system windowskin name
  554.   # @return [String]
  555.   def get_windowskin
  556.     $game_system.selected_windowskin.name
  557.   end
  558.  
  559.   # Sets the windowskin (useless, anyway)
  560.   def set_windowskin(value)
  561.     $game_system.set_windowskin(value)
  562.   end
  563.  
  564.   # Gets the system red tone
  565.   # @return [Integer]
  566.   def get_red_tone
  567.     $game_system.window_tone.red
  568.   end
  569.  
  570.   # Sets the system red tone
  571.   # @param [Integer] value
  572.   def set_red_tone(value)
  573.     $game_system.window_tone.red = value
  574.     $game_system.tone_customized = true
  575.   end
  576.  
  577.   # Gets the system green tone
  578.   # @return [Integer]
  579.   def get_green_tone
  580.     $game_system.window_tone.green
  581.   end
  582.  
  583.   # Sets the system green tone
  584.   # @param [Integer] value
  585.   def set_green_tone(value)
  586.     $game_system.window_tone.green = value
  587.     $game_system.tone_customized = true
  588.   end
  589.  
  590.   # Gets the system blue tone
  591.   # @return [Integer]
  592.   def get_blue_tone
  593.     $game_system.window_tone.blue
  594.   end
  595.  
  596.   # Sets the system blue tone
  597.   # @param [Integer] value
  598.   def set_blue_tone(value)
  599.     $game_system.window_tone.blue = value
  600.     $game_system.tone_customized = true
  601.   end
  602. end
  603.  
  604. #==============================================================================
  605. # ** Window_Base
  606. #------------------------------------------------------------------------------
  607. #  Windowskin reset for windows
  608. #==============================================================================
  609. class Window_Base < Window
  610.   alias h87_wskins_initialize initialize unless $@
  611.   # Initialization alias
  612.   # @param [Integer] x
  613.   # @param [Integer] y
  614.   # @param [Integer] width
  615.   # @param [Integer] height
  616.   def initialize(x, y, width, height)
  617.     h87_wskins_initialize(x, y, width, height)
  618.     refresh_windowskin
  619.   end
  620.  
  621.   # Loads the windowskin
  622.   #   need_refresh: true if you want to recreate contents and refresh.
  623.   def refresh_windowskin(need_refresh = false)
  624.     return unless $game_system
  625.     if $game_system.selected_windowskin != nil
  626.       $game_system.fallback_windowskin
  627.       self.windowskin = $game_system.selected_windowskin.bitmap
  628.       unless @boc
  629.         if $game_system.selected_windowskin.opacity != nil
  630.           self.back_opacity = $game_system.selected_windowskin.opacity
  631.           @boc = false
  632.         else
  633.           self.back_opacity = 192
  634.           @boc = false
  635.         end
  636.       end
  637.       if need_refresh
  638.         create_contents
  639.         refresh
  640.       end
  641.     end
  642.   end
  643.  
  644.   # Back opacity setting override
  645.   def back_opacity=(value)
  646.     super
  647.     @boc = true
  648.   end
  649. end
  650.  
  651. class Scene_MenuBase < Scene_Base
  652.   alias h87_wsk_create_background create_background unless $@
  653.   alias h87_wsk_dispose_background dispose_background unless $@
  654.   # Create Background
  655.   def create_background
  656.     h87_wsk_create_background
  657.     @background_sprite2 = Sprite.new
  658.     @background_sprite2.z = @background_sprite.z + 1 if @background_sprite
  659.     set_background2_bitmap
  660.   end
  661.  
  662.   def set_background2_bitmap
  663.     picture_name = $game_system.selected_windowskin.background
  664.     bitmap = picture_name.nil? ? nil : Cache.picture(picture_name)
  665.     @background_sprite2.bitmap = bitmap
  666.   end
  667.  
  668.   # Menu Background disposer
  669.   def dispose_background
  670.     h87_wsk_dispose_background
  671.     @background_sprite2.dispose
  672.   end
  673. end
  674.  
  675. #==============================================================================
  676. # ** Font_BK
  677. #------------------------------------------------------------------------------
  678. #  backup container for fonts
  679. #==============================================================================
  680. module Font_BK
  681.   # Stores the default font settings
  682.   def self.make_font_bk
  683.     @fdn = Font.default_name.clone
  684.     @fds = Font.default_size
  685.     @fdb = Font.default_bold
  686.     @fdi = Font.default_italic
  687.     @fdh = Font.default_shadow
  688.     @fdo = Font.default_outline
  689.     @fdc = Font.default_color.clone
  690.     @fdoc = Font.default_out_color.clone
  691.   end
  692.  
  693.   # Releases the stored settings to the font.
  694.   def self.default_name
  695.     @fdn;
  696.   end
  697.  
  698.   def self.default_size
  699.     @fds;
  700.   end
  701.  
  702.   def self.default_bold
  703.     @fdb;
  704.   end
  705.  
  706.   def self.default_italic
  707.     @fdi;
  708.   end
  709.  
  710.   def self.default_shadow
  711.     @fdh;
  712.   end
  713.  
  714.   def self.default_outline
  715.     @fdo;
  716.   end
  717.  
  718.   def self.default_color
  719.     @fdc;
  720.   end
  721.  
  722.   def self.default_out_color
  723.     @fdoc;
  724.   end
  725. end
  726.  
  727. #==============================================================================
  728. # ** DataManager
  729. #==============================================================================
  730. module DataManager
  731.   # noinspection ALL
  732.   class << self
  733.     alias wsk_extract_save_contents extract_save_contents
  734.   end
  735.  
  736.   # Alias method extract_save_contents
  737.   def self.extract_save_contents(contents)
  738.     wsk_extract_save_contents(contents)
  739.     $game_system.refresh_windowskin
  740.   end
  741. end
  742.  
  743. # Creates a backup for font default settings
  744. Font_BK.make_font_bk
  745.  
  746. # Inserts the option
  747. WindowskinsManager.set_options
Add Comment
Please, Sign In to add comment