Menu Principal de Quests v1.0
Menu Principal de Quests v1.0
Menu Principal de Quests v1.0
Por Alucard_2(eu mesmo)
Introdução
Este script modifica o menu principal para um menu com imagem de fundo, bem diferenciado e com janela de quests.
Como usar.
Apenas cole o script na seção de scripts adicionais.
Na linha 11 até a 15 tem o módulo Config, ali ficam as configurações.
Script
Spoiler for Hiden:
Código: [Selecionar]
################################################################################
# Menu de Quests #
################################################################################
# Por Alucard_2 #
################################################################################
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Classe de operações na tela do menu.
#==============================================================================
module Config
FUNDO = "plano-de-fundo-abstrato"
ID_Variável = 0 # ID da variável que indica quantas quests já foram feitas...
ID_Max = 1 # ID da variável que indica quantas quests podem ser feitas(total).
end
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do objeto
# menu_index : posição inicial do cursor
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@fundão = Plane.new
@fundão = Cache.system("plano-de-fundo-abstrato")
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status_window = Window_MenuStatus.new(160, 0)
@time_w = Window_PlayTime.new(174, 320)
@quests_w = Window_Quests.new(174 + @time_w.width + 20, 320)
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@fundão.dispose
@quests_w.dispose
@time_w.dispose
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@command_window.update
@gold_window.update
@quests_w.update
@status_window.update
@time_w.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# Criação da janela de comandos
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # Se não houver membros na equipe
@command_window.draw_item(0, false) # Desabilita "Items"
@command_window.draw_item(1, false) # Desabilita "Habilidades"
@command_window.draw_item(2, false) # Desabilita "Equipamentos"
@command_window.draw_item(3, false) # Desabilita "Status"
@command_window.draw_item(4, false) # desabilita [Censurado]
end
if $game_system.save_disabled # Se salvar for proibido
@command_window.draw_item(5, false) # Desabilita "Salvar"
end
end
#--------------------------------------------------------------------------
# Atualização da escolha de comando
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Habilidades, equipamento, status
start_actor_selection
when 4 # Salvar
$scene = Scene_File.new(true, false, false)
when 5 # Fim de jogo
$scene = Scene_End.new
when 6
$scene = Scene_GameOver.new
end
end
end
#--------------------------------------------------------------------------
# Início da seleção de herói
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# Fim da seleção de herói
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# Atualização da seleção de herói
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # Habilidades
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipamento
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
$scene = Scene_Status.new(@status_window.index)
when 5
$scene = Scene_GameOver.new(@status_window.index)
end
end
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Tempo de Jogo")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Window_Quests
#------------------------------------------------------------------------------
# Janela que mostra as quests feitas(em números).
#==============================================================================
class Window_Quests < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Quests Completas")
self.contents.font.color = normal_color
self.contents.draw_text(4, 0 + WLH * 1, 120, 32, "#{$game_variables[Config::ID_Variável]}")
self.contents.font.color = system_color
self.contents.draw_text(4 + 50, 32, 120, 32, "/")
self.contents.draw_text(4 + 60, 32, 120, 32, "#{$game_variables[Config::ID_Max]}")
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# Window_Selectable2
#------------------------------------------------------------------------------
# Classe que tem a função de gerenciar os movimentos do cursor nas janelas
# de seleção.2
#==============================================================================
class Window_Selectable2 < Window_Base
#--------------------------------------------------------------------------
# Variáveis públicas
#--------------------------------------------------------------------------
attr_reader :item_max # Máximo de items
attr_reader :column_max # Máximo de colunas
attr_reader :index # Posição do cursor
attr_reader :help_window # Janela de ajuda
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
# width : largura da janela
# height : altura da janela
# spacing : espaçamento entre items localizados próximos
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 32)
@item_max = 1
@column_max = 4
@index = -1
@spacing = spacing
super(x, y, width, height)
end
#--------------------------------------------------------------------------
# Criação do conteúdo da janela
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
end
#--------------------------------------------------------------------------
# Posicionamento do cursor
# index : o novo cursor
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# Número de linhas
#--------------------------------------------------------------------------
def row_max
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# Aquisição da informação da primeira linha
#--------------------------------------------------------------------------
def top_row
return self.oy / WLH
end
#--------------------------------------------------------------------------
# Configuração da primeira linha
# row : exibição da primeira linha
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * WLH
end
#--------------------------------------------------------------------------
# Máximo de linhas em uma página
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / WLH
end
#--------------------------------------------------------------------------
# Máximo de itens em uma página
#--------------------------------------------------------------------------
def page_item_max
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# Aquisição da informação da última linha
#--------------------------------------------------------------------------
def bottom_row
return top_row + page_row_max - 1
end
#--------------------------------------------------------------------------
# Configuração da última linha
# row : exibição da última linha
#--------------------------------------------------------------------------
def bottom_row=(row)
self.top_row = row - (page_row_max - 1)
end
#--------------------------------------------------------------------------
# Configuração do retângulo onde o item é desenhado
# index : número de itens
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# Configurações da janela de ajuda
# help_window : nova janela de ajuda
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
call_update_help
end
#--------------------------------------------------------------------------
# Verificação da possibilidade de movimento do cursor
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (index < 0 or index > @item_max or @item_max == 0)
return false if (@opening or @closing)
return true
end
#--------------------------------------------------------------------------
# Mover cursor para baixo
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + @column_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para cima
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - @column_max + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para direita
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if (@column_max >= 2) and
(@index < @item_max - 1 or (wrap and page_row_max == 1))
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para esquerda
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if (@column_max >= 2) and
(@index > 0 or (wrap and page_row_max == 1))
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Volta uma página com o cursor
#--------------------------------------------------------------------------
def cursor_pagedown
if top_row + page_row_max < row_max
@index = [@index + page_item_max, @item_max - 1].min
self.top_row += page_row_max
end
end
#--------------------------------------------------------------------------
# Avança uma página com o cursor
#--------------------------------------------------------------------------
def cursor_pageup
if top_row > 0
@index = [@index - page_item_max, 0].max
self.top_row -= page_row_max
end
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if Input.repeat?(Input::RIGHT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if Input.repeat?(Input::LEFT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::R)
cursor_pagedown
end
if Input.repeat?(Input::L)
cursor_pageup
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Se o cursor for menor que 0
self.cursor_rect.empty # Desabilita o cursor
else # Ou se o cursor for maior que 0
row = @index / @column_max # Pegue a linha atual
if row < top_row # Aparece na primeira linha
self.top_row = row # A linha atual se torna uma "scroll"
end
if row > bottom_row # É exibida a partir do final
self.bottom_row = row # A linha atual se torna uma "scroll"
end
rect = item_rect(@index) # Escolhe items que o retângulo pega
rect.y -= self.oy # Scroll da posição retangular
self.cursor_rect = rect # Atualização do cursor retangular
end
end
#--------------------------------------------------------------------------
# Atualização da janela de ajuda
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# Atualização da janela de ajuda (quando hereditariedade está definida)
#--------------------------------------------------------------------------
def update_help
end
end
#==============================================================================
# Window_MenuStatus
#------------------------------------------------------------------------------
# Janela que exibe os status dos membros da equipe no menu.
#==============================================================================
class Window_MenuStatus < Window_Selectable2
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 384, WLH * 8 + 2)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for actor in $game_party.members
draw_actor_graphic(actor, actor.index * 92.5 + 20, 50)
x = actor.index * 92.5 + WLH / 2
y = 5
draw_actor_name(actor, x, y - 5)
draw_actor_level(actor, x, y + WLH * 2)
draw_actor_state(actor, x, y + WLH * 3)
draw_actor_hp(actor, x, y + WLH * 4)
draw_actor_mp(actor, x, y + WLH * 5)
end
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Sem cursor
self.cursor_rect.empty
elsif @index < @item_max # Padrão
self.cursor_rect.set(@index * 96, 0, 92.5, contents.height)
elsif @index >= 100 # Si
self.cursor_rect.set((@index - 100) * 96, 0, 92.5, contents.height)
else # O todo
self.cursor_rect.set(0, 0, @item_max * 92.5, contents.height)
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# Exibição do HP
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 60)
draw_actor_hp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.hp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.hp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxhp, 2)
end
end
#--------------------------------------------------------------------------
# Exibição do HP em estado crítico
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 60)
gw = width * actor.hp / actor.maxhp
gc1 = hp_gauge_color1
gc2 = hp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# Exibição do MP
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 60)
draw_actor_mp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
self.contents.font.color = mp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.mp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.mp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxmp, 2)
end
end
#--------------------------------------------------------------------------
# Exibição do MP com baixo nível
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_mp_gauge(actor, x, y, width = 60)
gw = width * actor.mp / [actor.maxmp, 1].max
gc1 = mp_gauge_color1
gc2 = mp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end
Créditos e agradecimentos
Alucard_2, por criar o script e diponibiliza-lo aqui.
ScreenShots
Por Alucard_2(eu mesmo)
Introdução
Este script modifica o menu principal para um menu com imagem de fundo, bem diferenciado e com janela de quests.
Como usar.
Apenas cole o script na seção de scripts adicionais.
Na linha 11 até a 15 tem o módulo Config, ali ficam as configurações.
Script
Spoiler for Hiden:
Código: [Selecionar]
################################################################################
# Menu de Quests #
################################################################################
# Por Alucard_2 #
################################################################################
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Classe de operações na tela do menu.
#==============================================================================
module Config
FUNDO = "plano-de-fundo-abstrato"
ID_Variável = 0 # ID da variável que indica quantas quests já foram feitas...
ID_Max = 1 # ID da variável que indica quantas quests podem ser feitas(total).
end
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do objeto
# menu_index : posição inicial do cursor
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@fundão = Plane.new
@fundão = Cache.system("plano-de-fundo-abstrato")
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status_window = Window_MenuStatus.new(160, 0)
@time_w = Window_PlayTime.new(174, 320)
@quests_w = Window_Quests.new(174 + @time_w.width + 20, 320)
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@fundão.dispose
@quests_w.dispose
@time_w.dispose
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@command_window.update
@gold_window.update
@quests_w.update
@status_window.update
@time_w.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# Criação da janela de comandos
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # Se não houver membros na equipe
@command_window.draw_item(0, false) # Desabilita "Items"
@command_window.draw_item(1, false) # Desabilita "Habilidades"
@command_window.draw_item(2, false) # Desabilita "Equipamentos"
@command_window.draw_item(3, false) # Desabilita "Status"
@command_window.draw_item(4, false) # desabilita [Censurado]
end
if $game_system.save_disabled # Se salvar for proibido
@command_window.draw_item(5, false) # Desabilita "Salvar"
end
end
#--------------------------------------------------------------------------
# Atualização da escolha de comando
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Habilidades, equipamento, status
start_actor_selection
when 4 # Salvar
$scene = Scene_File.new(true, false, false)
when 5 # Fim de jogo
$scene = Scene_End.new
when 6
$scene = Scene_GameOver.new
end
end
end
#--------------------------------------------------------------------------
# Início da seleção de herói
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# Fim da seleção de herói
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# Atualização da seleção de herói
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # Habilidades
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipamento
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
$scene = Scene_Status.new(@status_window.index)
when 5
$scene = Scene_GameOver.new(@status_window.index)
end
end
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Tempo de Jogo")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Window_Quests
#------------------------------------------------------------------------------
# Janela que mostra as quests feitas(em números).
#==============================================================================
class Window_Quests < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Quests Completas")
self.contents.font.color = normal_color
self.contents.draw_text(4, 0 + WLH * 1, 120, 32, "#{$game_variables[Config::ID_Variável]}")
self.contents.font.color = system_color
self.contents.draw_text(4 + 50, 32, 120, 32, "/")
self.contents.draw_text(4 + 60, 32, 120, 32, "#{$game_variables[Config::ID_Max]}")
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# Window_Selectable2
#------------------------------------------------------------------------------
# Classe que tem a função de gerenciar os movimentos do cursor nas janelas
# de seleção.2
#==============================================================================
class Window_Selectable2 < Window_Base
#--------------------------------------------------------------------------
# Variáveis públicas
#--------------------------------------------------------------------------
attr_reader :item_max # Máximo de items
attr_reader :column_max # Máximo de colunas
attr_reader :index # Posição do cursor
attr_reader :help_window # Janela de ajuda
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
# width : largura da janela
# height : altura da janela
# spacing : espaçamento entre items localizados próximos
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 32)
@item_max = 1
@column_max = 4
@index = -1
@spacing = spacing
super(x, y, width, height)
end
#--------------------------------------------------------------------------
# Criação do conteúdo da janela
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
end
#--------------------------------------------------------------------------
# Posicionamento do cursor
# index : o novo cursor
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# Número de linhas
#--------------------------------------------------------------------------
def row_max
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# Aquisição da informação da primeira linha
#--------------------------------------------------------------------------
def top_row
return self.oy / WLH
end
#--------------------------------------------------------------------------
# Configuração da primeira linha
# row : exibição da primeira linha
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * WLH
end
#--------------------------------------------------------------------------
# Máximo de linhas em uma página
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / WLH
end
#--------------------------------------------------------------------------
# Máximo de itens em uma página
#--------------------------------------------------------------------------
def page_item_max
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# Aquisição da informação da última linha
#--------------------------------------------------------------------------
def bottom_row
return top_row + page_row_max - 1
end
#--------------------------------------------------------------------------
# Configuração da última linha
# row : exibição da última linha
#--------------------------------------------------------------------------
def bottom_row=(row)
self.top_row = row - (page_row_max - 1)
end
#--------------------------------------------------------------------------
# Configuração do retângulo onde o item é desenhado
# index : número de itens
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# Configurações da janela de ajuda
# help_window : nova janela de ajuda
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
call_update_help
end
#--------------------------------------------------------------------------
# Verificação da possibilidade de movimento do cursor
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (index < 0 or index > @item_max or @item_max == 0)
return false if (@opening or @closing)
return true
end
#--------------------------------------------------------------------------
# Mover cursor para baixo
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + @column_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para cima
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - @column_max + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para direita
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if (@column_max >= 2) and
(@index < @item_max - 1 or (wrap and page_row_max == 1))
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# Mover cursor para esquerda
# wrap : permissão de wrap
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if (@column_max >= 2) and
(@index > 0 or (wrap and page_row_max == 1))
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# Volta uma página com o cursor
#--------------------------------------------------------------------------
def cursor_pagedown
if top_row + page_row_max < row_max
@index = [@index + page_item_max, @item_max - 1].min
self.top_row += page_row_max
end
end
#--------------------------------------------------------------------------
# Avança uma página com o cursor
#--------------------------------------------------------------------------
def cursor_pageup
if top_row > 0
@index = [@index - page_item_max, 0].max
self.top_row -= page_row_max
end
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if Input.repeat?(Input::RIGHT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if Input.repeat?(Input::LEFT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::R)
cursor_pagedown
end
if Input.repeat?(Input::L)
cursor_pageup
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Se o cursor for menor que 0
self.cursor_rect.empty # Desabilita o cursor
else # Ou se o cursor for maior que 0
row = @index / @column_max # Pegue a linha atual
if row < top_row # Aparece na primeira linha
self.top_row = row # A linha atual se torna uma "scroll"
end
if row > bottom_row # É exibida a partir do final
self.bottom_row = row # A linha atual se torna uma "scroll"
end
rect = item_rect(@index) # Escolhe items que o retângulo pega
rect.y -= self.oy # Scroll da posição retangular
self.cursor_rect = rect # Atualização do cursor retangular
end
end
#--------------------------------------------------------------------------
# Atualização da janela de ajuda
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# Atualização da janela de ajuda (quando hereditariedade está definida)
#--------------------------------------------------------------------------
def update_help
end
end
#==============================================================================
# Window_MenuStatus
#------------------------------------------------------------------------------
# Janela que exibe os status dos membros da equipe no menu.
#==============================================================================
class Window_MenuStatus < Window_Selectable2
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 384, WLH * 8 + 2)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for actor in $game_party.members
draw_actor_graphic(actor, actor.index * 92.5 + 20, 50)
x = actor.index * 92.5 + WLH / 2
y = 5
draw_actor_name(actor, x, y - 5)
draw_actor_level(actor, x, y + WLH * 2)
draw_actor_state(actor, x, y + WLH * 3)
draw_actor_hp(actor, x, y + WLH * 4)
draw_actor_mp(actor, x, y + WLH * 5)
end
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Sem cursor
self.cursor_rect.empty
elsif @index < @item_max # Padrão
self.cursor_rect.set(@index * 96, 0, 92.5, contents.height)
elsif @index >= 100 # Si
self.cursor_rect.set((@index - 100) * 96, 0, 92.5, contents.height)
else # O todo
self.cursor_rect.set(0, 0, @item_max * 92.5, contents.height)
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# Exibição do HP
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 60)
draw_actor_hp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.hp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.hp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxhp, 2)
end
end
#--------------------------------------------------------------------------
# Exibição do HP em estado crítico
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 60)
gw = width * actor.hp / actor.maxhp
gc1 = hp_gauge_color1
gc2 = hp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# Exibição do MP
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 60)
draw_actor_mp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
self.contents.font.color = mp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.mp, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.mp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxmp, 2)
end
end
#--------------------------------------------------------------------------
# Exibição do MP com baixo nível
# actor : herói
# x : exibe na coordenada X
# y : exibe na coordenada Y
# width : largura
#--------------------------------------------------------------------------
def draw_actor_mp_gauge(actor, x, y, width = 60)
gw = width * actor.mp / [actor.maxmp, 1].max
gc1 = mp_gauge_color1
gc2 = mp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end
Créditos e agradecimentos
Alucard_2, por criar o script e diponibiliza-lo aqui.
ScreenShots
Convidad- Convidado
Re: Menu Principal de Quests v1.0
Parabéns pela 44 mensagens O-O ...script interessante..
Soul Maker- Moderador Global
- Reputação : 9
Permissões neste sub-fórum
Não podes responder a tópicos
|
|