Gabriel_Nascimento

** Esteem - Simplified One Player Menu

Jan 12th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.99 KB | None | 0 0
  1. #===============================================================================
  2. #  ** Esteem - Simplified One Player Menu
  3. #-------------------------------------------------------------------------------
  4. #  ► Atualizações: 19/09/17 (v1.0)
  5. #                  12/01/18 (v1.1) - Adicionado compatibilidade para ativar ou
  6. #                                    desativar os comandos com base em switches.
  7. #===============================================================================
  8. #  * Menu simplificado para um personagem com apenas os comandos desejados.
  9. #  * Sem janela dos personagens( Status_Window ).
  10. #===============================================================================
  11. #  * Para configurar vide a área configurável abaixo.
  12. #===============================================================================
  13. #  ► Script por: Skyloftian
  14. #===============================================================================
  15.  
  16. #===============================================================================
  17. #  * CONFIGURAÇÕES
  18. #===============================================================================
  19. module Esteem
  20.   module SOP_Menu
  21.      
  22.   GOLD_WINDOW = true # Ativar ou não a janela de ouro.
  23.                      # true = ativa | false = desativa
  24.  
  25. #-------------------------------------------------------------------------------
  26. #  * Comandos que devem ficar ativos, true = ativa | false = desativa
  27. #-------------------------------------------------------------------------------
  28.   ENABLED_COMMANDS = { # Não apague!
  29.  
  30.         # :comando   => [true/false/switch, "Nome de Exibição no Menu"],
  31.         #                Use true para que o comando esteja sempre ativo
  32.         #                Use false para os comandos que não deseja usar no menu
  33.         #                Use um número para corresponder a uma switch que ativa
  34.         #                e desativa o comando.
  35.           :item      => [true,  "Itens"],
  36.           :skill     => [01,    "Habilidades"],
  37.           :equip     => [false, ""],
  38.           :status    => [false, ""],
  39.           :save      => [true,  "Salvar"],
  40.           :game_end  => [true,  "Sair"]
  41.          
  42.           } # Não apague!
  43.          
  44.   end # SOP_Menu
  45. end #Esteem
  46. #===============================================================================
  47. # > Fim das Configurações
  48. #   - Aqui termina a área configurável do script e começa o código. Não recomen-
  49. #   do que o altere, isso é, a menos que tenha certeza do que está fazendo.
  50. #===============================================================================
  51. class Window_MenuCommand < Window_Command
  52.   include Esteem::SOP_Menu
  53.  
  54.   def make_command_list
  55.     add_enabled_commands
  56.   end
  57.  
  58.   def add_enabled_commands
  59.       ENABLED_COMMANDS.each do |s, k|
  60.       case s
  61.       when s
  62.         if k[0] != true && k[0] != false
  63.           if $game_switches[k[0]]
  64.             add_command(k[1],   s,   main_commands_enabled)
  65.           end
  66.         elsif k[0]
  67.           add_command(k[1],   s,   main_commands_enabled)
  68.         end
  69.       end
  70.     end
  71.   end
  72.  
  73. end # Window_MenuCommand
  74. class Scene_Menu < Scene_MenuBase
  75.   include Esteem::SOP_Menu
  76.  
  77.   def start
  78.     super
  79.     create_command_window
  80.     create_gold_window if GOLD_WINDOW
  81.     set_windows_positions
  82.   end
  83.  
  84.   def set_windows_positions
  85.     @command_window.x = (Graphics.width / 2) - (@command_window.width / 2)
  86.     if GOLD_WINDOW
  87.       @command_window.y = ((Graphics.height / 2) - (@command_window.height / 2)) - (@gold_window.height / 2)
  88.       @gold_window.x = @command_window.x
  89.       @gold_window.y = @command_window.y + @command_window.height
  90.     else
  91.       @command_window.y = (Graphics.height / 2) - (@command_window.height / 2)
  92.     end
  93.   end
  94.  
  95.   def command_personal
  96.     case @command_window.current_symbol
  97.     when :skill
  98.       SceneManager.call(Scene_Skill)
  99.     when :equip
  100.       SceneManager.call(Scene_Equip)
  101.     when :status
  102.       SceneManager.call(Scene_Status)
  103.     end
  104.   end
  105.  
  106. end # Scene_Menu
Add Comment
Please, Sign In to add comment