Skyloftian_Link

Janela Especial - Valor de Variável

Jan 20th, 2017
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # Janela Especial - Valor de Variável
  3. #-------------------------------------------------------------------------------
  4. # Por: Skyloftian
  5. #===============================================================================
  6. # > Versão 1.0
  7. #-------------------------------------------------------------------------------
  8. # > Atualizações:
  9. #   - 20/01/17 (v0.1) : Concluído
  10. #===============================================================================
  11. # > Função:
  12. #   - Mostra uma janela com um texto e o valor de uma variável.
  13. #===============================================================================
  14. # > Script feito sob medida para o membro guKing
  15. #===============================================================================
  16. # > Dúvidas e afins? Acesse: www.centrorpg.com
  17. #===============================================================================
  18. module Esteem
  19.   module Moves
  20.    
  21.     # Configure aqui as informações vitáis do script
  22.    
  23.     SWITCH   = 1 # ID da Switch que mostra/esconde a janela
  24.    
  25.     TEXT     = "Movimentos disponíveis para o Shard:" # Texto que aparecerá na janela
  26.     VARIABLE = 1 # ID da Variável que guarda o valor a ser mostrado na janela
  27.    
  28.     WIND_X   = 0   # Posição horizontal da janela
  29.     WIND_Y   = 0   # Posição vertical da janela
  30.     WIDTH    = 310 # Largura da janela
  31.    
  32.   end # Moves
  33. end # Esteem
  34. #=============================================================
  35. # > Window_Variable < Window_Base
  36. #=============================================================
  37. class Window_Variable < Window_Base
  38.   include Esteem::Moves
  39.  
  40.   #---------------------------------------------------------
  41.   # ~ Initialize
  42.   #---------------------------------------------------------
  43.   def initialize
  44.     super(WIND_X, WIND_Y, window_width, fitting_height(1))
  45.     self.openness = 0
  46.   end
  47.  
  48.   #---------------------------------------------------------
  49.   # ~ Window_Width
  50.   #---------------------------------------------------------
  51.   def window_width
  52.     return WIDTH
  53.   end
  54.  
  55.   #---------------------------------------------------------
  56.   # ~ Refresh
  57.   #---------------------------------------------------------
  58.   def refresh
  59.     text = TEXT
  60.     value = $game_variables[VARIABLE]
  61.     contents.clear
  62.     draw_text(0, 0, 5 + text_size(text).width, text_size(text).height, text)
  63.     draw_text(5 + text_size(text).width, 0, 5 + text_size(value).width, text_size(value).height, value)
  64.   end
  65.  
  66.   #---------------------------------------------------------
  67.   # ~ Update
  68.   #---------------------------------------------------------
  69.   def update
  70.     super
  71.     update_openness
  72.     refresh
  73.   end
  74.  
  75.   #---------------------------------------------------------
  76.   # ~ Update_Openness
  77.   #---------------------------------------------------------
  78.   def update_openness
  79.     open if $game_switches[SWITCH]
  80.     close if !$game_switches[SWITCH]
  81.   end
  82.  
  83. end # Window_Variable
  84.  
  85. #=============================================================
  86. # > Scene_Map < Scene_Base
  87. #=============================================================
  88. class Scene_Map < Scene_Base
  89.  
  90.   #---------------------------------------------------------
  91.   # ~ Create_All_Window
  92.   #---------------------------------------------------------
  93.   alias :new_placement :create_all_windows
  94.   def create_all_windows
  95.     new_placement
  96.     create_window_variable
  97.   end
  98.  
  99.   #---------------------------------------------------------
  100.   # ~ Create_Window_Variable
  101.   #---------------------------------------------------------
  102.   def create_window_variable
  103.     @variable_window = Window_Variable.new
  104.   end
  105.  
  106. end # Scene_Map
RAW Paste Data