Olá camaradas,
Navegando nas web achei um menu muito do loco, mas para usá-lo legalmente no meu mega projeto que está show de bola eu preciso mudar uns detalhes.
1º Como vão ver o script cria um menu com layout próprio sem as bordas da windowskin, mas eu adoro as bordas da minha windowskin e as queria de volta.
2º "Itens", "Status" e etc tem seus nomes editáveis, ok, mas porque ajustar a esquerda?, centraliza esse texto para mim?
3º Help é sempre útil, mas não quando está rolando como um letreiro que fica na borda do telejornal. Será que da, por obsequio, alguem mais entendido de script que eu fazer este help ficar parado?
4º e ultimo esse é mais pessoal, estou usando faces 64x64, dá pra mudar o tamanho e centralizar...
Desde já agradeço e o script está aqui:
[EDIT] Encontrei um script muuuuuuito melhor e que já atende a maioria destas necessidades. Obrigado pelo espaço.
Navegando nas web achei um menu muito do loco, mas para usá-lo legalmente no meu mega projeto que está show de bola eu preciso mudar uns detalhes.
1º Como vão ver o script cria um menu com layout próprio sem as bordas da windowskin, mas eu adoro as bordas da minha windowskin e as queria de volta.
2º "Itens", "Status" e etc tem seus nomes editáveis, ok, mas porque ajustar a esquerda?, centraliza esse texto para mim?
3º Help é sempre útil, mas não quando está rolando como um letreiro que fica na borda do telejornal. Será que da, por obsequio, alguem mais entendido de script que eu fazer este help ficar parado?
4º e ultimo esse é mais pessoal, estou usando faces 64x64, dá pra mudar o tamanho e centralizar...
Desde já agradeço e o script está aqui:
Código:
#===============================================================================
# Name: Dark's Super Simple Menu
# Author: Nhat Nguyen (Dark Sky)
# Released on: May 28th 2016
#-------------------------------------------------------------------------------
# Version 1.0: Released!
#-------------------------------------------------------------------------------
# Plug and play!
#===============================================================================
module DarkCreation
module SuperSimpleMenu
WINDOW_X = 140
WINDOW_y = 155
BACKGROUND_OPACITY = 255
HELP_FONT = ["Calibri"]
NON_COMBAT_STYLE = true
COMMANDS = {
:item => [63,"Mochila","Acessa o menu de itens"],
:skill => [47,"Magias","Exibe as magias"],
:equip => [79,"Equipamentos","Mostra seus equipamentos"],
:status => [122,"Estado","veja o estado do grupo"],
:save => [236,"Save","Save current process"],
:game_end => [95,"Sair","Para sair ou voltar ao título"],
}
NON_COMBAT_STYLE_LIST = [:save, :formation, :status]
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================
include DarkCreation::SuperSimpleMenu
class Window_MenuCommand < Window_Command
attr_accessor :list
attr_accessor :dhelp_window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(WINDOW_X, WINDOW_y)
@dcontents.x = self.x
@dcontents.y = self.y
@dcontents2.x = 150 + (self.x - 100)
@dcontents2.y = 105 + (self.y - 100)
@dcontents.opacity = 0
@dcontents2.opacity = 0
self.opacity = 0
self.back_opacity = 0
select_last
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 48
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
alias :dark_dispose_window_menu_qwe :dispose
def dispose
dark_dispose_window_menu_qwe
@dcontents.bitmap.dispose
@dcontents.dispose
@dcontents2.bitmap.dispose
@dcontents2.dispose
end
#--------------------------------------------------------------------------
# * Draw Character Graphic
#--------------------------------------------------------------------------
def draw_character2(character_name, character_index, x, y)
return unless character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
@cw = cw
@dcontents2.bitmap.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_graphic2(actor, x, y)
draw_character2(actor.character_name, actor.character_index, x, y)
end
#--------------------------------------------------------------------------
# * Draw Face Graphic
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_face2(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
@dcontents2.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# * Draw Actor Face Graphic
#--------------------------------------------------------------------------
def draw_actor_face2(actor, x, y, enabled = true)
draw_face2(actor.face_name, actor.face_index, x, y, enabled)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
@dcontents ||= Sprite.new
@dcontents.bitmap ||= Bitmap.new(self.width - 5,self.height - 5)
@dcontents.bitmap.clear
@dcontents.bitmap.fill_rect(5,5,self.width,self.height,Color.new(0,0,0,BACKGROUND_OPACITY)) #contents.fill_rect(0,0,contents.width,contents.height,Color.new(0,0,0,170))
@dcontents2 ||= Sprite.new
@dcontents2.bitmap ||= Bitmap.new(233,108)#self.width - 5,self.height - 5)
@dcontents2.bitmap.clear
@dcontents2.bitmap.font.name = HELP_FONT
@dcontents2.bitmap.fill_rect(0,0,233,108,Color.new(0,0,0,BACKGROUND_OPACITY))
draw_actor_graphic2($game_party.members[0],20,43)
x = @dcontents2.width - 96
draw_actor_face2($game_party.members[0],x,7)
@actor_info = "#{$game_party.members[0].name}"# | #{$game_party.members[0].class.name}"
@dcontents2.bitmap.font.size -= 6
@dcontents2.bitmap.draw_text(@cw + 10,5,233,24,@actor_info)
@dcontents2.bitmap.font.color = Color.new(253,155,51)
@dcontents2.bitmap.draw_text(@cw + 10,5+24,233,24,"#{$game_party.members[0].class.name}")
@dcontents2.bitmap.font.color = Color.new(255,255,255)
@dcontents2.bitmap.draw_text(5,5+24+24,233,24,"Ouro: #{$game_party.gold}$")
@dcontents2.bitmap.draw_text(5,5+24*3,233,24,"Lugar: #{$game_map.display_name}")
draw_all_items
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
end
#--------------------------------------------------------------------------
# * Add Main Commands to List
#--------------------------------------------------------------------------
def add_main_commands
COMMANDS.each_key do |key|
next if NON_COMBAT_STYLE_LIST.include?(key) && NON_COMBAT_STYLE
add_command(COMMANDS[key][1], key, main_commands_enabled)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
change_color(normal_color, command_enabled?(index))
rect = item_rect_for_text(index)
rect.x = 0
draw_icon(COMMANDS[@list[index][:symbol]][0],rect.x,rect.y)
end
#--------------------------------------------------------------------------
# * Process cursor move
#--------------------------------------------------------------------------
alias dark_menucommand_process_cursor_move_213 process_cursor_move
def process_cursor_move
dark_menucommand_process_cursor_move_213
@dhelp_window.refresh(true)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias dark_menucommand_update_213 update
def update
dark_menucommand_update_213
if @dcontents.opacity < 255
@dcontents.opacity += 10
@dcontents2.opacity += 10
end
if @dhelp_window
@dhelp_window.refresh
end
end
end
include DarkCreation::SuperSimpleMenu
class Window_HelpScroll < Window_Base
attr_accessor :target
attr_accessor :index
def initialize(x,y,width,height)
super(x,y,width,height)
self.opacity = 0
self.back_opacity = 0
@scroll_pos = 0
@opacity = 0
end
def target=(tar)
if tar.is_a?(Window)
@target = tar
create_assets
refresh
end
end
def dispose
super
@dcontents.bitmap.dispose
@dcontents.dispose
@d_scroll.bitmap.dispose
@d_scroll.dispose
end
def cal_text_width(text)
size = 0
for i in 0...text.size
size += text_size(text[i]).width
end
return size
end
def create_assets
@dcontents = Sprite.new
@dcontents.bitmap = Bitmap.new(self.width - 5,self.height - 5)
@dcontents.bitmap.clear
@dcontents.bitmap.fill_rect(5,5,self.width,self.height,Color.new(0,0,0,BACKGROUND_OPACITY - 20))
@d_scroll = Sprite.new
@d_scroll.bitmap ||= Bitmap.new(544,416)
@dcontents.bitmap.fill_rect(8,@dcontents.bitmap.height - 30,self.width - 16,26,Color.new(0,0,0,BACKGROUND_OPACITY + 30))
@w_width = self.width - 16
@w_height = 26
@w_x = 8
@w_y = @dcontents.bitmap.height - 30
@viewport = Viewport.new(5,5,544,416)
@viewport.z = 990
@dcontents.viewport = @viewport
@d_scroll.bitmap.clear
@dcontents.x = self.x
@dcontents.y = self.y
@viewport1 = Viewport.new(self.x + 14,self.y+32,@w_width-1,@w_height)
@viewport1.z = 999
@dcontents.bitmap.font.name = HELP_FONT
@d_scroll.bitmap.font.name = HELP_FONT
@d_scroll.bitmap.font.size = 15
@d_scroll.viewport = @viewport1
@dcontents.opacity = @d_scroll.opacity = 0
@index = -1
end
def refresh(reset=false)
@d_scroll.bitmap.clear
@dcontents.bitmap.clear
@text = COMMANDS[@target.list[@target.index][:symbol]][2]
if @dcontents.opacity < 255
@dcontents.opacity += 5
@d_scroll.opacity += 5
end
if @index != @target.index
@scroll_pos = -@w_width+1
@d_scroll.ox = @scroll_pos
@index = @target.index
else
@dcontents.bitmap.fill_rect(5,5,self.width,self.height,Color.new(0,0,0,BACKGROUND_OPACITY - 20))
@dcontents.bitmap.fill_rect(8,@dcontents.bitmap.height - 30,self.width - 16,26,Color.new(0,0,0,BACKGROUND_OPACITY + 30))
@dcontents.bitmap.draw_text(8,-1,@dcontents.bitmap.width,24,COMMANDS[@target.list[@target.index][:symbol]][1])
end
@d_scroll.bitmap.draw_text(2,4,cal_text_width(@text),24,@text)
@d_scroll.ox = @scroll_pos
@scroll_pos += 1
if @scroll_pos > cal_text_width(@text) - 10
@scroll_pos = -@w_width+1
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_command_window
#create_gold_window
#create_status_window
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@scroll_help = Window_HelpScroll.new(@command_window.x - 4,@command_window.y,9*32,32*2)
@scroll_help.y = @command_window.y - @scroll_help.height
@scroll_help.target = @command_window
@command_window.dhelp_window = @scroll_help
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:skill, method(:on_personal_ok))
@command_window.set_handler(:equip, method(:on_personal_ok))
@command_window.set_handler(:status, method(:on_personal_ok))
@command_window.set_handler(:formation, method(:command_formation))
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# * Create Gold Window
#--------------------------------------------------------------------------
def create_gold_window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = Graphics.height - @gold_window.height
end
#--------------------------------------------------------------------------
# * Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_MenuStatus.new(@command_window.width, 0)
end
#--------------------------------------------------------------------------
# * [Item] Command
#--------------------------------------------------------------------------
def command_item
SceneManager.call(Scene_Item)
end
#--------------------------------------------------------------------------
# * [Skill], [Equipment] and [Status] Commands
#--------------------------------------------------------------------------
def command_personal
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_personal_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
#--------------------------------------------------------------------------
# * [Formation] Command
#--------------------------------------------------------------------------
def command_formation
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_formation_ok))
@status_window.set_handler(:cancel, method(:on_formation_cancel))
end
#--------------------------------------------------------------------------
# * [Save] Command
#--------------------------------------------------------------------------
def command_save
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# * [Exit Game] Command
#--------------------------------------------------------------------------
def command_game_end
SceneManager.call(Scene_End)
end
#--------------------------------------------------------------------------
# * [OK] Personal Command
#--------------------------------------------------------------------------
def on_personal_ok
case @command_window.current_symbol
when :skill
SceneManager.call(Scene_Skill)
when :equip
SceneManager.call(Scene_Equip)
when :status
SceneManager.call(Scene_Status)
end
end
#--------------------------------------------------------------------------
# * [Cancel] Personal Command
#--------------------------------------------------------------------------
def on_personal_cancel
@status_window.unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# * Formation [OK]
#--------------------------------------------------------------------------
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------------------------------------------------------------------
# * Formation [Cancel]
#--------------------------------------------------------------------------
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
@status_window.unselect
@command_window.activate
end
end
end
[EDIT] Encontrei um script muuuuuuito melhor e que já atende a maioria destas necessidades. Obrigado pelo espaço.