1 Menu Avançado de Save 3/5/2012, 19:53
The Lucas Wugades
Membro Honorário III
Menu Avançado de Save
Ele faz um menu de save mito diferente testem.
Intruçôes
Cole nos scripts adicionais
Criado por ziifee
Ele faz um menu de save mito diferente testem.
Intruçôes
Cole nos scripts adicionais
Criado por ziifee
- Código:
#==============================================================================
# Menu Avançado de Save
# Criado por ziifee
# [url=http://www.ReinoRpg.com]www.ReinoRpg.com[/url]
#==============================================================================
module Neom16
# Número de arquivos (Horizontal x Vertical)
FILE_X = 4 # Número de arquivos na horizontal
FILE_Y = 4 # Número de arquivos na vertical
NO = "Vazio ..." # Arquivo sem nome
# Configuração geral (true = sim / false = não)
FILE_NAME = true # Mostrar nome do arquivo (true / false)
FACE_UP = true # Mostrar faces (true / false)
GRAPHIC = true # Mostrar characters (true / false)
NAME = true # Mostrar nomes (true / false)
TOP_NAME = true # Mostrar nome no topo (true / false)
MAP = true # Mostrar mapa (true / false)
COLOR = Color.new(-255, -200, -68) # Cor do nome do mapa (R, G, B)
def self.file_size # Cálculo dos arquivos
return FILE_X * FILE_Y
end
end
#==============================================================================
# Window_SaveFile
#==============================================================================
class Window_SaveFile < Window_Base
def initialize(file_index, filename)
super(8, 180 + (Neom16::FILE_NAME ? 0 : WLH), 526, 230 - (Neom16::FILE_NAME ? 0 : WLH))
self.visible = false
@file_index = file_index
@filename = filename
load_gamedata
refresh
delete_gamedata
end
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
dummy = Marshal.load(file)
@frame_count = Marshal.load(file)
dummy = Marshal.load(file)
dummy = Marshal.load(file)
@game_system = Marshal.load(file)
dummy = Marshal.load(file)
dummy = Marshal.load(file)
dummy = Marshal.load(file)
dummy = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
def delete_gamedata
@frame_count = nil
@game_system = nil
@game_actors = nil
@game_party = nil
@total_sec = nil
end
def refresh
self.contents.clear
name = Vocab::File + " [email=#{@file_index]#{@file_index[/email] + 1}"
@name_width = contents.text_size(name).width
y = -WLH
if Neom16::FILE_NAME
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 200, WLH, name)
y = 0
end
if @file_exist
draw_party_characters(0, y + (Neom16::FACE_UP ? 24 : 100))
sub_y = y + WLH + (Neom16::FACE_UP ? 100 : 0)
draw_top_actor(0, sub_y)
if Neom16::MAP
self.contents.font.color = Neom16::COLOR
self.contents.draw_text(4, sub_y, contents.width - 8, WLH ,
@game_system.save_map, 2)
end
draw_currency_value(@game_party.gold, 4, WLH + sub_y, contents.width - 8)
draw_playtime(0, WLH * 2 + sub_y, contents.width - 4, 2)
else
y = (contents.height + y) / 2
self.contents.draw_text(0, y, contents.width, WLH, Neom16::NO, 1)
end
end
def draw_party_characters(x, y)
for i in [email=0...@game_party.actors.size]0...@game_party.actors.size[/email]
actor = @game_actors[@game_party.actors[i]]
draw_actor_face(actor, x + i * 124, y)
draw_actor_graphic(actor, x + i * 124 + 100, y + 96) if Neom16::GRAPHIC
if Neom16::NAME
self.contents.font.size = 16
draw_actor_name(actor, x + i * 124 + 2, y + 74)
self.contents.font.size = 20
end
end
end
def draw_top_actor(x, y)
return if @game_party.actors.empty?
actor = @game_actors[@game_party.actors[0]]
draw_actor_name(actor, x, y) if Neom16::TOP_NAME
draw_actor_level(actor, x + (Neom16::TOP_NAME ? 108 : 0), y)
length = Neom16::TOP_NAME ? 168 : 120
draw_actor_hp(actor, x, y + WLH, length)
draw_actor_mp(actor, x, y + WLH * 2, length)
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_reader :actors
end
#==============================================================================
# Window_LineHelp
#==============================================================================
class Window_LineHelp < Window_Base
def initialize
super(-16, 0, 576, WLH + 32)
self.opacity = 0
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
back_color = Color.new(0, 0, 0, 80)
self.contents.fill_rect(0, y = 12, contents.width, WLH - y, back_color)
self.contents.font.color = normal_color
self.contents.draw_text(20, 0, self.width - 72, WLH, text, align)
@text = text
@align = align
end
end
end
#==============================================================================
# Window_FileCommand
#==============================================================================
class Window_FileCommand < Window_Command
def initialize(index, size)
set = []
for i in 0...size do set.push(Vocab::File + " #{i + 1}") end
super(544, set, (size + 1) / Neom16::FILE_Y)
self.y = 48
self.opacity = 0
@index = index
self.update
end
end
#==============================================================================
# Scene_File
#==============================================================================
class Scene_File < Scene_Base
def start
super
create_menu_background
@help_window = Window_LineHelp.new
create_savefile_windows
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@command_window = Window_FileCommand.new(@index, @item_max)
for i in [email=0...@savefile_windows.size]0...@savefile_windows.size[/email]
window = @savefile_windows[i]
@command_window.draw_item(i, false) unless window.file_exist
end
@savefile_windows[@index].visible = true
end
def terminate
super
@command_window.dispose
dispose_menu_background
@help_window.dispose
dispose_item_windows
end
def update
super
update_menu_background
@command_window.update
@help_window.update
update_savefile_windows
update_savefile_selection
end
def date_index
return @command_window.index
end
def create_savefile_windows
@savefile_windows = []
for i in 0...Neom16.file_size
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
@item_max = @savefile_windows.size
end
def update_savefile_windows
for i in [email=0...@savefile_windows.size]0...@savefile_windows.size[/email]
window = @savefile_windows[i]
window.visible = (i == date_index)
window.update
end
end
def update_savefile_selection
if Input.trigger?(Input::C)
determine_savefile
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
end
def determine_savefile
if @saving
Sound.play_save
do_save
else
if @savefile_windows[date_index].file_exist
Sound.play_load
do_load
else
Sound.play_buzzer
return
end
end
$game_temp.last_file_index = date_index
end
def do_save
file = File.open(@savefile_windows[date_index].filename, "wb")
write_save_data(file)
file.close
return_scene
end
def do_load
file = File.open(@savefile_windows[date_index].filename, "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
end
class Game_System
attr_writer :save_map
def save_map
return "" if @save_map == nil
return @save_map
end
end
class Scene_File < Scene_Base
alias neomemo16_map write_save_data
def write_save_data(file)
map_infos = load_data("Data/MapInfos.rvdata")
$game_system.save_map = map_infos[$game_map.map_id].name
neomemo16_map(file)
end
end
Última edição por The Lucas Wugades em 3/5/2012, 20:11, editado 1 vez(es)