Lackluster
Member
PHP:
class Window_PlayTime1< Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time")
@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
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
#Gold Window
#==============================================================================
class Window_Gold1 < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
refresh
end
#--------------------------------------------------------------------------
def refresh
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon($goldicon)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#==============================================================================
#Scene Menu_Load
#==============================================================================
class Scene_MenuLoad < Scene_File
#--------------------------------------------------------------------------
def initialize
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Load from which file?")
end
#--------------------------------------------------------------------------
def on_decision(filename)
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$scene = Scene_Menu.new(5)
print "Game File Loaded!"
end
#--------------------------------------------------------------------------
def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
end
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end
#==============================================================================
#Steps Window
#==============================================================================
$data_mapinfos = load_data('Data/MapInfos.rxdata')
class Window_Steps1 < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 66) #96
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
refresh
end
#--------------------------------------------------------------------------
def refresh
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon($stepsicon)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
contents.clear
contents.font.color = normal_color
name = $data_mapinfos[$game_map.map_id].name
contents.draw_text(0, 0, 128, 32, name)
end
end
#==============================================================================
# Menu End
#==============================================================================
class Scene_MenuEnd
#--------------------------------------------------------------------------
def main
s1 = "Return to Title"
s2 = "Exit to Windows"
s3 = "Cancel"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
def update
@command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(6)
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_to_title
when 1
command_shutdown
when 2
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
def command_to_title
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
def command_cancel
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new(6)
end
end
#==============================================================================
#Menu Save
#==============================================================================
class Scene_MenuSave < Scene_File
#--------------------------------------------------------------------------
def initialize
super("Save to which file?")
end
#--------------------------------------------------------------------------
def on_decision(filename)
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
print "Game Succesfully Saved!"
end
#--------------------------------------------------------------------------
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end