Confira o Videos Épicos #45!
2 Respostas   240 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
#==============================================================================# +++ MOG - Scroll Bar (V1.2) +++#==============================================================================# By Moghunter# http://www.atelier-rgss.com#==============================================================================# Adiciona uma barra de rolamento nas janelas quando a lista de itens é maior # que a altura da janela.#==============================================================================# Histórico.#==============================================================================# 1.2 - Melhoria de compatibilidade.#==============================================================================module MOG_SCROLL_BAR #Definição da posição da barra de deslize. SCROLL_BAR_POSITION = [-6,8] #Definição da posição Z. SCROLL_BAR_Z = 100 #Definição da cor na imagem baseado no Windowskin. SCROLL_BAR_COLOR = [72,96] SCROLL_BACKGROUND_COLOR = [64,96] #Switch que, quando ativa, o script não funcionará. SCROLL_BAR_SWITCH = 1end$imported = {} if $imported.nil?$imported[:mog_scroll_bar] = true#==============================================================================# ■ Window Selectable#==============================================================================class Window_Selectable < Window_Base include MOG_SCROLL_BAR #-------------------------------------------------------------------------- # * Create Scroll Bar #-------------------------------------------------------------------------- def create_scroll_bar @scroll_bitmap = true return if row_max < 1 return if $game_switches[SCROLL_BAR_SWITCH] @sc_active = self.active ; @sb_sprite = []; @sb_sprite_px = 0 2.times do |i| @sb_sprite[i] = Sprite.new; @sb_sprite[i].opacity = 0 @sb_sprite[i].bitmap = Bitmap.new(4,self.height - 16) end refresh_scroll_bar ; update_scroll_bar end #-------------------------------------------------------------------------- # * Refresh Scroll Bar #-------------------------------------------------------------------------- def refresh_scroll_bar return if @sb_sprite == nil @sc_active = self.active refresh_scroll_point ; refresh_scroll_background end #-------------------------------------------------------------------------- # * Refresh Scroll Point #-------------------------------------------------------------------------- def refresh_scroll_point @sb_sprite[1].bitmap.clear row_max_sc = row_max > 20 ? 20 : row_max @sb_row_zize = @sb_sprite[1].bitmap.height / row_max_sc + 1 @row_range_y = @sb_sprite[1].bitmap.height.to_f / row_max @sb_row_max = self.y + self.height + 8 - (@sb_row_zize + 16) sc_rect = Rect.new(SCROLL_BAR_COLOR[0],SCROLL_BAR_COLOR[1],4,8) sc_rect2 = Rect.new(0,0,6,@sb_row_zize) @sb_sprite[1].bitmap.stretch_blt(sc_rect2, self.windowskin, sc_rect) @sb_sprite[1].z = self.z + SCROLL_BAR_Z + 1; @sb_sprite[1].opacity = 0 @sb_sprite[1].visible = can_scroll_bar_visible? end #-------------------------------------------------------------------------- # * Refresh Scroll Background #-------------------------------------------------------------------------- def refresh_scroll_background @sb_sprite[0].bitmap.clear @sb_sprite_px = self.width - (-SCROLL_BAR_POSITION[0] + @sb_sprite[0].bitmap.width) sc_rect = Rect.new(SCROLL_BACKGROUND_COLOR[0],SCROLL_BACKGROUND_COLOR[1],6,8) sc_rect2 = Rect.new(0,0,6,@sb_sprite[0].bitmap.height) @sb_sprite[0].bitmap.stretch_blt(sc_rect2, self.windowskin, sc_rect) @sb_sprite[0].z = self.z + SCROLL_BAR_Z; @sb_sprite[0].opacity = 0 @sb_sprite[0].visible = can_scroll_bar_visible? end #-------------------------------------------------------------------------- # * Can Scroll Bar Visible #-------------------------------------------------------------------------- def can_scroll_bar_visible? return false if row_max <= page_row_max return true end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- alias mog_sc_dispose dispose def dispose mog_sc_dispose dispose_scroll_bar end #-------------------------------------------------------------------------- # * Dispose Scroll Bar #-------------------------------------------------------------------------- def dispose_scroll_bar return if @sb_sprite == nil @sb_sprite.each {|sprite| sprite.bitmap.dispose ; sprite.dispose } end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- alias mog_sc_update update def update mog_sc_update update_scroll_bar end #-------------------------------------------------------------------------- # * Update Scroll Bar #-------------------------------------------------------------------------- def update_scroll_bar create_scroll_bar if @scroll_bitmap == nil return if @sb_sprite == nil refresh_scroll_bar if @sc_active != self.active @sb_sprite[0].y = self.y + 8; @sb_sprite[1].y = scroll_bar_y @sb_sprite[1].y = @sb_row_max if @sb_sprite[1].y > @sb_row_max @sb_sprite.each {|sprite| sprite.x = self.x + @sb_sprite_px; update_sc_visible(sprite)} end #-------------------------------------------------------------------------- # * Update SC Visible #-------------------------------------------------------------------------- def update_sc_visible(sprite) if self.active sprite.opacity += 15 ; sprite.opacity = 0 if !self.visible else sprite.opacity -= 30 end end #-------------------------------------------------------------------------- # * Scroll Bar Y #-------------------------------------------------------------------------- def scroll_bar_y self.y + SCROLL_BAR_POSITION[1] + (@row_range_y * row) end end
SCROLL_BAR_SWITCH = 1
Código: [Selecionar]#==============================================================================# +++ MOG - Scroll Bar (V1.2) +++#==============================================================================# By Moghunter# http://www.atelier-rgss.com#==============================================================================# Adiciona uma barra de rolamento nas janelas quando a lista de itens é maior # que a altura da janela.#==============================================================================# Histórico.#==============================================================================# 1.2 - Melhoria de compatibilidade.#==============================================================================module MOG_SCROLL_BAR #Definição da posição da barra de deslize. SCROLL_BAR_POSITION = [-6,8] #Definição da posição Z. SCROLL_BAR_Z = 100 #Definição da cor na imagem baseado no Windowskin. SCROLL_BAR_COLOR = [72,96] SCROLL_BACKGROUND_COLOR = [64,96] #Switch que, quando ativa, o script não funcionará. SCROLL_BAR_SWITCH = 1end$imported = {} if $imported.nil?$imported[:mog_scroll_bar] = true#==============================================================================# ■ Window Selectable#==============================================================================class Window_Selectable < Window_Base include MOG_SCROLL_BAR #-------------------------------------------------------------------------- # * Create Scroll Bar #-------------------------------------------------------------------------- def create_scroll_bar @scroll_bitmap = true return if row_max < 1 return if $game_switches[SCROLL_BAR_SWITCH] @sc_active = self.active ; @sb_sprite = []; @sb_sprite_px = 0 2.times do |i| @sb_sprite[i] = Sprite.new; @sb_sprite[i].opacity = 0 @sb_sprite[i].bitmap = Bitmap.new(4,self.height - 16) end refresh_scroll_bar ; update_scroll_bar end #-------------------------------------------------------------------------- # * Refresh Scroll Bar #-------------------------------------------------------------------------- def refresh_scroll_bar return if @sb_sprite == nil @sc_active = self.active refresh_scroll_point ; refresh_scroll_background end #-------------------------------------------------------------------------- # * Refresh Scroll Point #-------------------------------------------------------------------------- def refresh_scroll_point @sb_sprite[1].bitmap.clear row_max_sc = row_max > 20 ? 20 : row_max @sb_row_zize = @sb_sprite[1].bitmap.height / row_max_sc + 1 @row_range_y = @sb_sprite[1].bitmap.height.to_f / row_max @sb_row_max = self.y + self.height + 8 - (@sb_row_zize + 16) sc_rect = Rect.new(SCROLL_BAR_COLOR[0],SCROLL_BAR_COLOR[1],4,8) sc_rect2 = Rect.new(0,0,6,@sb_row_zize) @sb_sprite[1].bitmap.stretch_blt(sc_rect2, self.windowskin, sc_rect) @sb_sprite[1].z = self.z + SCROLL_BAR_Z + 1; @sb_sprite[1].opacity = 0 @sb_sprite[1].visible = can_scroll_bar_visible? end #-------------------------------------------------------------------------- # * Refresh Scroll Background #-------------------------------------------------------------------------- def refresh_scroll_background @sb_sprite[0].bitmap.clear @sb_sprite_px = self.width - (-SCROLL_BAR_POSITION[0] + @sb_sprite[0].bitmap.width) sc_rect = Rect.new(SCROLL_BACKGROUND_COLOR[0],SCROLL_BACKGROUND_COLOR[1],6,8) sc_rect2 = Rect.new(0,0,6,@sb_sprite[0].bitmap.height) @sb_sprite[0].bitmap.stretch_blt(sc_rect2, self.windowskin, sc_rect) @sb_sprite[0].z = self.z + SCROLL_BAR_Z; @sb_sprite[0].opacity = 0 @sb_sprite[0].visible = can_scroll_bar_visible? end #-------------------------------------------------------------------------- # * Can Scroll Bar Visible #-------------------------------------------------------------------------- def can_scroll_bar_visible? return false if row_max <= page_row_max return true end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- alias mog_sc_dispose dispose def dispose mog_sc_dispose dispose_scroll_bar end #-------------------------------------------------------------------------- # * Dispose Scroll Bar #-------------------------------------------------------------------------- def dispose_scroll_bar return if @sb_sprite == nil @sb_sprite.each {|sprite| sprite.bitmap.dispose ; sprite.dispose } end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- alias mog_sc_update update def update mog_sc_update update_scroll_bar end #-------------------------------------------------------------------------- # * Update Scroll Bar #-------------------------------------------------------------------------- def update_scroll_bar create_scroll_bar if @scroll_bitmap == nil return if @sb_sprite == nil refresh_scroll_bar if @sc_active != self.active @sb_sprite[0].y = self.y + 8; @sb_sprite[1].y = scroll_bar_y @sb_sprite[1].y = @sb_row_max if @sb_sprite[1].y > @sb_row_max @sb_sprite.each {|sprite| sprite.x = self.x + @sb_sprite_px; update_sc_visible(sprite)} end #-------------------------------------------------------------------------- # * Update SC Visible #-------------------------------------------------------------------------- def update_sc_visible(sprite) if self.active sprite.opacity += 15 ; sprite.opacity = 0 if !self.visible else sprite.opacity -= 30 end end #-------------------------------------------------------------------------- # * Scroll Bar Y #-------------------------------------------------------------------------- def scroll_bar_y self.y + SCROLL_BAR_POSITION[1] + (@row_range_y * row) end endAdicionei duas linhas no script.Na configuração, é só configurar isto:Código: [Selecionar]SCROLL_BAR_SWITCH = 1