Advertisement
Sainthell

Saell Tutorial Scene - Content Window

Aug 15th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 13.38 KB | None | 0 0
  1. #-----------------------------------------------------------------------------#
  2. # Saell - Tutorial Scene v1.02 - Contents Extended
  3. # Autor/Author: Sainthell
  4. # Data/Date: 8/11/15
  5. # Recomendado/Recommended: Tsukihime Scene Interpreter
  6. #-----------------------------------------------------------------------------#
  7. # Changelog
  8. # 8/15/15 - Código atualizado / Script updated
  9. #
  10. # 8/13/15 - Update no tamanho da Window_TutorialDescr / Updates on
  11. # Window_TutorialDescr's parameters
  12. #
  13. # 8/11/15 - Script Terminado / Finished Script
  14. #
  15. #-----------------------------------------------------------------------------#
  16. # Descrição
  17. # Faz uma cena personalizada, que roda eventos comums. O script Scene
  18. # Interpreter do autor Tsukihime é altamente recomendado, já que permite eventos
  19. # comuns rodarem em menus.
  20. #
  21. # Description
  22. # Makes a custom scene that runs common events. Tsukihime's Scene Interpreter
  23. # is highly recommended, as it makes common events run on scenes.
  24. #
  25. #-----------------------------------------------------------------------------#
  26. # Agradecimentos Especiais
  27. # Esses agradecimentos vão para todos os que me ajudaram, de uma maneira ou
  28. # outra, a conseguir fazer esse script, diretamente, ou indiretamente, na
  29. # criação desse script.
  30. #
  31. # Special Thanks
  32. # I would like to thank you all who helped me out, in one way or another to
  33. # make it through, directly or indirectly, during the creation of this script.
  34. #
  35. # - Feldherren      - Masked
  36. # - Hudell          - Tsukihime
  37. # - DP3             - Trihan
  38. # - Khas            - Balack Maniactics
  39. # - Sonic Ghost
  40. #
  41. #-----------------------------------------------------------------------------#
  42. # Terms of Use
  43. # You're free to use this script in any game you want, just credit Sainthell
  44. # and those thanked for the help in making this script.
  45. #
  46. # Termos de Uso
  47. # Você está livre para usar esse script em qualquer jogo que desejar. Só credite
  48. # o autor (Sainthell) e os que ajudaram no script.
  49. #
  50. #-----------------------------------------------------------------------------#
  51. # FAQ
  52. # 1- Criando seu comando / Creating your command
  53. # Na hash TUTORIAL_LIST, faça uma nova entrada de tal maneira:
  54. # On the TUTORIAL_LIST hash, make a new entry following this syntax:
  55. #
  56. # :simbolo/:symbol =>
  57. # ["Nome"/"Name",
  58. # "Descrição"/"Description",
  59. #  ID de evento comum/Common event ID],
  60. #
  61. # 2- Adicionando seu comando / Adding your Command
  62. # Adicione o SIMBOLO da sua entrada na array COMMAND, e pronto!
  63. # Add your first command entry (AKA the :symbol) on the COMMAND array.
  64. #
  65. #-----------------------------------------------------------------------------#
  66. module SRC
  67.  
  68.   MENU_NAME= "Tutorial"                  #Menu Name / Nome do Menu
  69.   INITIAL_TEXT= "Escolha seu tutorial."  #Help window text / Texto de Ajuda
  70.   CONTENT_TEXT= "Conteúdo"               #Texto de conteúdo do Tutorial
  71.   USE_DESCRIPTION = true                 #Usar janela de descrição? /
  72.                                          #Use description window?
  73.  
  74.   COMMAND = [
  75.   #Add commands made in TUTORIAL_LIST here
  76.   :tutorial1,
  77.   :tutorial2,
  78.   :tutorial3,
  79.   :tutorial4,
  80.   :tutorial5,
  81.   :tutorial6,
  82.   :tutorial7,
  83.   ]
  84.  
  85.   TUTORIAL_LIST ={
  86.   :tutorial1 =>  
  87.   ["Basico",        
  88.   "Explicação dos básicos do jogo, \ncomo: \n
  89.  •Classes\n  •Parâmetros\n  •Habilidades\n  •Equipamento\n  •Estados",              
  90.    1],
  91.    
  92.   :tutorial2 =>  
  93.   ["Classes",  
  94.   "Explicação sobre classes, e \nseus tipos mais comuns.\n
  95.  •Física\n  •Mágica\n  •Suporte\n  •Debuff\n  •Mistas",
  96.    2],
  97.    
  98.   :tutorial3 =>  
  99.   ["Parâmetros",      
  100.   "Explicação sobre tipos de \nparâmetros, e seus usos.\n
  101.  •Parâmetros Base\n  •Parâmetros Extras\n  •Parâmetros Especiais",
  102.    3],
  103.  
  104.   :tutorial4 =>  
  105.   ["Habilidades (Ativas)",  
  106.   "Explicação sobre habilidades \nativas, e seus tipos principais.\n
  107.  •Dano\n  •Proteção\n  •Cura\n  •Buff\n  •Debuff\n  •Mistas",
  108.    4],
  109.  
  110.   :tutorial5 =>  
  111.   ["Habilidades (Passivas)",  
  112.   "Explicação sobre habilidades \npassivas, notando seus tipos \nprincipais.\n
  113.  •Adição de Habilidade\n  •Movimento\n  •Reação\n  •Aprimoramento\n  ",
  114.    5],
  115.    
  116.   :tutorial6 =>  
  117.   ["Equipamento",  
  118.   "Explicação dos tipos de \nequipamento, como:\n
  119.  •Armas\n  •Escudos\n  •Capacetes\n  •Armaduras\n  •Acessórios",
  120.    6],
  121.  
  122.   :tutorial7 =>  
  123.   ["Estados",  
  124.   "Explicação sobre estados, \ncitando os mais comuns, como:\n
  125.  •Envenenado\n  •Paralisia\n  •Sono\n  •Desacordado\n  ",
  126.    7],
  127.  
  128.   } # Do not touch / Não toque
  129.  
  130.  
  131. end
  132.  
  133.  
  134.    
  135. #Scene Setup
  136. class SaellTutorialScene < Scene_Base
  137.   #--------------------------------------------------------------------------
  138.   # * Inicialização do processo
  139.   #--------------------------------------------------------------------------
  140.   def start
  141.     super()
  142.     create_help_window
  143.     create_command_window
  144.   end
  145.  
  146.  
  147.   def create_help_window
  148.     @shelp_window = Window_Help.new
  149.     @shelp_window.viewport = @viewport
  150.   end
  151.  
  152.  
  153.   def create_command_window
  154.     wy = @shelp_window.height
  155.     ww = Graphics.width / 2
  156.     wh = Graphics.height - @shelp_window.height
  157.     @list_window = Window_Smain.new(0, @shelp_window.height, 200)
  158.     @list_window.activate
  159.     @list_window.set_handler(:cancel,  method(:return_scene))
  160.   end
  161.  
  162.  
  163.   #--------------------------------------------------------------------------
  164.   # * Processamento pós-inicio
  165.   #--------------------------------------------------------------------------
  166.   def post_start
  167.     super()
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # * Atualização da tela
  171.   #--------------------------------------------------------------------------
  172.   def update
  173.     super()
  174.     @shelp_window.set_text(SRC::INITIAL_TEXT)
  175.   end
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # * Definição de habilitação de seleção
  179.   #--------------------------------------------------------------------------
  180.   def current_item_enabled?
  181.     enable?(@data[index])
  182.   end
  183. end
  184.  
  185.   #--------------------------------------------------------------------------
  186.   # * Processamento pré finalização
  187.   #--------------------------------------------------------------------------
  188.   def pre_terminate
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # * Finalização do processo
  192.   #--------------------------------------------------------------------------
  193.   def terminate
  194.     super()
  195.     @shelp_window.dispose
  196.     @list_window.dispose
  197.   end #End SaellTutorialScene
  198.  
  199. #==============================================================================
  200. # ** Window_Content
  201. #------------------------------------------------------------------------------
  202. #  Essa é a janela de descrição secundária do script.
  203. #==============================================================================
  204.   class Window_Content < Window_Base # Tutorial Description Window
  205.    
  206.   attr_accessor :tutorial_window # Atributo
  207.   #--------------------------------------------------------------------------
  208.   # * inicialização da janela
  209.   #--------------------------------------------------------------------------
  210.    def initialize(x, y, width, height)
  211.      super(x, y, width, height)
  212.      refresh
  213.    end
  214.  
  215.   #--------------------------------------------------------------------------
  216.   # * Atualização da janela de descrição
  217.   #--------------------------------------------------------------------------
  218.   def update
  219.     super
  220.     refresh
  221.     end
  222.  
  223.    def refresh
  224.     draw_text_ex(width / 3 ,0,SRC::CONTENT_TEXT)
  225.    end
  226.  end # End Description Window
  227.  
  228. #==============================================================================
  229. # ** Window_Tutorialdescr
  230. #------------------------------------------------------------------------------
  231. #  Essa é a janela de descrição principal do script.
  232. #==============================================================================
  233.   class Window_Tutorialdescr < Window_Base # Tutorial Description Window
  234.    
  235.   attr_accessor :tutorial_window # Atributo
  236.   #--------------------------------------------------------------------------
  237.   # * inicialização da janela
  238.   #--------------------------------------------------------------------------
  239.    def initialize(tutorial_window, x, y, width, height)
  240.      @tutorial_window = tutorial_window # Propriedade
  241.      @data = []
  242.      super(x, y, width, height)
  243.      refresh
  244.    end
  245.  
  246.   #--------------------------------------------------------------------------
  247.   # * Atualização da janela de descrição
  248.   #--------------------------------------------------------------------------
  249.   def update
  250.     super
  251.     refresh
  252.     @tutorial_window.index
  253.   end
  254.  
  255.    def refresh
  256.     return if @index == @tutorial_window.index
  257.     @data = SRC::COMMAND
  258.     item = []
  259.     item = @data[tutorial_window.index]
  260.     contents.clear
  261.     draw_text_ex(0,0,SRC::TUTORIAL_LIST[item][1])
  262.    end
  263.  end # End Description Window
  264.  
  265.  
  266. #==============================================================================
  267. # ** Window_Smain
  268. #------------------------------------------------------------------------------
  269. #  Essa é a lista de itens de comando da cena
  270. #==============================================================================
  271.  class Window_Smain < Window_Selectable
  272.      
  273.   #--------------------------------------------------------------------------
  274.   # * inicialização do processo
  275.   #--------------------------------------------------------------------------
  276.   def initialize(x, y, width)
  277.     super(0 , y, width, Graphics.height - y)
  278.     data = []
  279.     self.index = 0
  280.     if SRC::USE_DESCRIPTION == true
  281.     @content_window = Window_Content.new(200, y, Graphics.width - 200, 50)
  282.     @content_window.viewport = @viewport
  283.     yy = y +@content_window.height
  284.     @tutorial_window = Window_Tutorialdescr.new(self, 200, yy, Graphics.width - 200, Graphics.height - yy)
  285.     @tutorial_window.viewport = @viewport
  286.     end
  287.     activate
  288.     refresh
  289.     set_handler(:ok, method(:command_tutorial_list))
  290.   end
  291.  
  292.   #--------------------------------------------------------------------------
  293.   # * inicialização, definição, e processamento de index
  294.   #--------------------------------------------------------------------------
  295.   def item_max
  296.     @data ? @data.size : 1
  297.   end
  298.    
  299.   def make_item_list
  300.     @data = SRC::COMMAND
  301.   end
  302.  
  303.  
  304.   def draw_item(index)
  305.     item = @data[index]
  306.     if item
  307.       rect = item_rect_for_text(index)
  308.       draw_text(rect, SRC::TUTORIAL_LIST[item][0])
  309.     end
  310.   end
  311.  
  312.   def command_tutorial_list
  313.     $game_temp.reserve_common_event(SRC::TUTORIAL_LIST[item][2])
  314.     activate
  315.   end
  316.  
  317.   def select(index)
  318.     self.index = index if index
  319.     if SRC::USE_DESCRIPTION == true
  320.     @tutorial_window.contents.clear
  321.     @tutorial_window.draw_text_ex(0,0,SRC::TUTORIAL_LIST[item][1])
  322.     end
  323.   end
  324.  
  325.   def item
  326.    @data && index >= 0 ? @data[index] : nil
  327.   end
  328.  
  329.   #--------------------------------------------------------------------------
  330.   # * atualização da janela
  331.   #--------------------------------------------------------------------------
  332.   def refresh
  333.     make_item_list
  334.     create_contents
  335.     draw_all_items
  336.   end
  337.  
  338.   def dispose
  339.     super
  340.     @tutorial_window.dispose
  341.     @content_window.dispose
  342.   end
  343. end #End Window_Smain
  344.  
  345.    
  346. #==============================================================================
  347. # ** Window_MenuCommand
  348. #------------------------------------------------------------------------------
  349. #  Esta janela exibe os comandos do menu.
  350. #==============================================================================
  351.  
  352. class Window_MenuCommand < Window_Command
  353.   #--------------------------------------------------------------------------
  354.   # * Adição de comandos próprios
  355.   #--------------------------------------------------------------------------
  356.   alias saell_original_commands add_original_commands
  357.   #----------------------------------------------------
  358.   def add_original_commands
  359.     saell_original_commands
  360.     add_command(SRC::MENU_NAME, :tutorial)
  361.   end
  362. end
  363.   #--------------------------------------------------------------------------
  364.   # * interpreter
  365.   #--------------------------------------------------------------------------
  366. class Scene_Base
  367.   def interpreter
  368.     @interpreter
  369.   end
  370. end
  371. #==============================================================================
  372. # ** Scene_Menu
  373. #------------------------------------------------------------------------------
  374. #  Esta classe executa o processamento da tela de menu.
  375. #==============================================================================
  376.  
  377. class Scene_Menu < Scene_MenuBase
  378.   #--------------------------------------------------------------------------
  379.   # * Criação da janela de comando
  380.   #--------------------------------------------------------------------------
  381.   alias saell_command_window create_command_window
  382.   def create_command_window
  383.     saell_command_window()
  384.     @command_window.set_handler(:tutorial,      method(:command_tutorial))
  385.   end
  386.  
  387.   #--------------------------------------------------------------------------
  388.   # * definir command_tutorial
  389.   #--------------------------------------------------------------------------
  390.   def command_tutorial
  391.     SceneManager.call(SaellTutorialScene)
  392.   end
  393. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement