#encoding:utf-8
#==============================================================================
# ■在 【薄雾年代记 —— 存档公开版 by LBQ v0.2 】上进行修改
#------------------------------------------------------------------------------
#
#==============================================================================
$imported||={}
$imported[:mcr_save] = '0.2'
module MCR
module Save
CHAPTER_NUM = 1
end
end
module Cache
include MCR::Save
#--------------------------------------------------------------------------
# ● 读取IZUMISAVELOAD中的内容
#--------------------------------------------------------------------------
def self.izumisl(filename)
load_bitmap("Graphics/Izumi_SL/", filename)
end
end
module DataManager
#--------------------------------------------------------------------------
# ● 生成需要使用的数据
#--------------------------------------------------------------------------
def self.make_save_header
header = {}
header[:characters] = $game_party.characters_for_savefile
header[:playtime_s] = $game_system.playtime_s
header[:variables] = $game_variables
header[:map_name] = $game_map.display_name
header
end
end
#encoding:utf-8
#==============================================================================
# ■ CLASS Sprite
#------------------------------------------------------------------------------
# 作为後续使用
#==============================================================================
class Sprite
#--------------------------------------------------------------------------
# ● 创造选项贴图
#--------------------------------------------------------------------------
def paste(bitmap)
sb = bitmap
a = 0
b = 0
src_rect = Rect.new(a,b,sb.width,sb.height)
self.bitmap.blt(a,b,sb,src_rect)
bitmap.dispose
end
#--------------------------------------------------------------------------
# ● 绘制FILE_X的文字
#--------------------------------------------------------------------------
def drawfiletext(text)
a = 0
b = 0
self.z = 200
self.bitmap = Bitmap.new(880,70)
src_rect = Rect.new(a,b,self.bitmap.width,self.bitmap.height)
self.bitmap.font.outline= false
self.bitmap.font.size = 23
self.bitmap.font.color.set(175, 175, 175)
self.bitmap.draw_text(src_rect, text, 1)
end
#--------------------------------------------------------------------------
# ● 绘制游戏时间
#--------------------------------------------------------------------------
def drawplaytimetext(text)
a = 0
b = 30
self.z = 200
self.bitmap = Bitmap.new(250,100)
src_rect = Rect.new(a,b,self.bitmap.width,self.bitmap.height)
self.bitmap.font.outline= false
self.bitmap.font.size = 36
self.bitmap.font.color.set(255, 255, 255)
self.bitmap.draw_text(src_rect, text, 1)
end
#--------------------------------------------------------------------------
# ● 绘制所在地点的文字
#--------------------------------------------------------------------------
def drawmaptext(text)
a = 0
b = 30
self.z = 200
self.bitmap = Bitmap.new(800,100)
src_rect = Rect.new(a,b,self.bitmap.width,self.bitmap.height)
self.bitmap.font.outline= false
self.bitmap.font.size = 36
self.bitmap.font.color.set(255, 255, 255)
self.bitmap.draw_text(src_rect, text, 1)
end
end
#encoding:utf-8
#==============================================================================
# ■ CLASS Sprite
#------------------------------------------------------------------------------
# 创造Sprite的父类作为後续使用
#==============================================================================
class Part_Save
include MCR::Save
#--------------------------------------------------------------------------
# ●初始化Part_Save
#--------------------------------------------------------------------------
def initialize(index)
@index = index
@delegates = []
@Facenumber
@sprite = Sprite.new
@filename = Sprite.new
@playtime = Sprite.new
@mapname = Sprite.new
@delegates << @sprite
@delegates << @filename
@delegates << @playtime
@delegates << @mapname
@selectin = 1
#创造数字(File的字样)
@filename.drawfiletext("FILE #{@index+1}")
@filename.x = @sprite.x+520
#创造数字(游戏时间的字样)
@playtime.drawplaytimetext(play_time_s)
@playtime.x = @sprite.x+190
#创造名称(存档所在地图的字样)
@mapname.drawmaptext(map)
@mapname.x = @sprite.x+390
reload
@sprite.bitmap = Cache.izumisl("SaveScreem_#{@selectin}")
@empty_file = Sprite.new
if does_not_exist
@empty_file.bitmap = Cache.izumisl("Face_2")
else
@sprite.paste Cache.izumisl("Face_#{@Facenumber}")
end
unselected
end
#--------------------------------------------------------------------------
# ● 取得时间的字串
#--------------------------------------------------------------------------
def play_time_s
return 'Empty' if does_not_exist
return header[:playtime_s].split(":")[0..1].join(':')
end
#--------------------------------------------------------------------------
# ● 取得所在地图的字串
#--------------------------------------------------------------------------
def map
return nil if does_not_exist
return header[:map_name]
end
#--------------------------------------------------------------------------
# ● 重建的函数(好像不会被用到)
#--------------------------------------------------------------------------
def recreate_sprite
index = @index
reload
@sprite.bitmap = Cache.izumisl("SaveScreem_#{@selectin}")
if does_not_exist
@sprite.paste Cache.izumisl("Face_2")
else
@sprite.paste Cache.izumisl("Face_#{@Facenumber}")
end
end
#--------------------------------------------------------------------------
# ● 透过1号开关重读Facenumber的数字
#--------------------------------------------------------------------------
def reload
unless does_not_exist
if $game_switches[1] == false
@Facenumber =1
else
@Facenumber =0
end
else
@Facenumber =2
end
end
#--------------------------------------------------------------------------
# ● 取得变数(不太知道要干嘛TWT
#--------------------------------------------------------------------------
def variables
return if does_not_exist
return header[:variables]
end
#--------------------------------------------------------------------------
# ● 判断档案是否不存在
#--------------------------------------------------------------------------
def does_not_exist
!header
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
@sprite.dispose
@sprite=nil
@filename.dispose
@playtime.dispose
@mapname.dispose
@empty_file.dispose
end
#--------------------------------------------------------------------------
# ● 取得@index号档案是否存在
#--------------------------------------------------------------------------
def header
return DataManager.load_header(@index)
end
#--------------------------------------------------------------------------
# ● 取得是否有在选择状态
#--------------------------------------------------------------------------
def selected?
@selected
end
#--------------------------------------------------------------------------
# ● 每回刷新
#--------------------------------------------------------------------------
def update
if @selected
@delegates.each do |d|
d.opacity = [@sprite.opacity+12,255].min
end
else
@delegates.each do |d|
d.opacity = [@sprite.opacity-12,150].max
end
end
end
#--------------------------------------------------------------------------
# ● 选择时的def
#--------------------------------------------------------------------------
def selected
@selected = true
@selectin = 2
#self.opacity = 255
end
#--------------------------------------------------------------------------
# ● 没有选择时的def
#--------------------------------------------------------------------------
def unselected
@selected = false
@selectin = 1
#self.opacity = 180
end
#--------------------------------------------------------------------------
# ● 看不懂,好像是侦错用的
#--------------------------------------------------------------------------
def method_missing(id,*args,&block)
sended = false
@delegates.each do |d|
if d.respond_to? id
sended = true
d.send id,*args,&block
end
end
unless sended
super
end
end
end
#encoding:utf-8
#==============================================================================
# ■ EasyLoad
#------------------------------------------------------------------------------
# 简单存档的插件
#==============================================================================
module Scene_EasyLoad_Plugin
def easy_load(index)
DataManager.load_game(index)
Sound.play_load
fadeout_all
$game_system.on_after_load
SceneManager.goto(Scene_Map)
end
end
#encoding:utf-8
#==============================================================================
# ■ SenceBase
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_Base
include Scene_EasyLoad_Plugin
end
#encoding:utf-8
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 存档/读档画面的父类
#==============================================================================
class Scene_File < Scene_MenuBase
include LBQ::IZUMI_Titler
public_instance_methods(false).each do |m|
undef_method m
end
#--------------------------------------------------------------------------
# ● 开始时
#--------------------------------------------------------------------------
def start
super
@main_timer = 0
methods.each do |m|
if m.to_s.include? 'create_'
send m
end
end
post_create
@start_fade_out = false
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
terminate_all_sprites
end
#--------------------------------------------------------------------------
# ● 结束处理所有的sprite
#--------------------------------------------------------------------------
def terminate_all_sprites
@parts.each(&:dispose)
end
#--------------------------------------------------------------------------
# ●开始创造存档格
#--------------------------------------------------------------------------
def post_create
@parts[0].selected
end
#--------------------------------------------------------------------------
# ●回到前一个场景
#--------------------------------------------------------------------------
def return_scene
return
@start_fade_out = false
end
#--------------------------------------------------------------------------
# ●创造上面那排字
#--------------------------------------------------------------------------
def create_header
@header = Sprite.new
@header.z = 10
@header.bitmap = Cache.izumisl('Savefont')
@header.ox = 145
@header.x= 512
@header.y = 62
end
#--------------------------------------------------------------------------
# ● 创造存档格
#--------------------------------------------------------------------------
def create_parts
@parts = []
@parts[0] = Part_Save.new(0)
@parts[0].ox = 310
@parts[0].x = 512
@parts[0].y = 150
@parts[1] = Part_Save.new(1)
@parts[1].ox = 310
@parts[1].x = 512
@parts[1].y = 295
@parts[2] = Part_Save.new(2)
@parts[2].ox = 310
@parts[2].x = 512
@parts[2].y = 420
end
#--------------------------------------------------------------------------
# ● 遮罩的创造
#--------------------------------------------------------------------------
def create_mask
@mask = Sprite.new
w = Graphics.width
h = Graphics.height
@mask.bitmap = Bitmap.new w, h
@mask.bitmap.fill_rect(0,0,w,h,Color.new(0,0,0))
@mask.opacity = 0
@mask.z = 999
end
#--------------------------------------------------------------------------
# ● 每回刷新
#--------------------------------------------------------------------------
def update
@main_timer += 1 #计时器+1
methods.each do |m|
if m.to_s.include? 'update_'
send m
end
end
deal_with_mask_fade if @start_fade_out
end
#--------------------------------------------------------------------------
# ● 渐入遮罩
#--------------------------------------------------------------------------
def deal_with_mask_fade
@mask.opacity +=8
if @mask.opacity >=255
fadeout_all
SceneManager.return
end
end
#--------------------------------------------------------------------------
# ● 回传20
#--------------------------------------------------------------------------
def transition_speed
return 20
end
#--------------------------------------------------------------------------
# ● 更新输入
#--------------------------------------------------------------------------
def update_input
if Input.trigger? :UP
i_am_going_to_select = @parts[current_selected_index - 1]
if i_am_going_to_select && current_selected_index!=0
current_selected.unselected
i_am_going_to_select.selected
Sound.play_cursor
else
Sound.play_buzzer
end
end
if Input.trigger? :DOWN
i_am_going_to_select = @parts[current_selected_index + 1]
if i_am_going_to_select
current_selected.unselected
i_am_going_to_select.selected
Sound.play_cursor
else
Sound.play_buzzer
end
end
if Input.trigger? :C
deal_with_on_ok
end
if Input.trigger? :B
Sound.play_cancel
SceneManager.return
end
end
#--------------------------------------------------------------------------
# ●每回将遮罩淡出
#--------------------------------------------------------------------------
def update_mask
@mask.opacity -= 4
end
#--------------------------------------------------------------------------
# ●使用current_selected时回传选取状态
#--------------------------------------------------------------------------
def current_selected
return @parts.select{|p|p.selected?}[0]
end
#--------------------------------------------------------------------------
# ●使用current_selected_index时回传选取到哪一个index
#--------------------------------------------------------------------------
def current_selected_index
return @parts.index current_selected
end
#--------------------------------------------------------------------------
# ●更新parts
#--------------------------------------------------------------------------
def update_parts
@parts.each(&:update)
end
end
#encoding:utf-8
#==============================================================================
# ■ SenceSave
#------------------------------------------------------------------------------
#存档画面
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# ●存档时存在选择的那一格
#--------------------------------------------------------------------------
def deal_with_on_ok
DataManager.save_game(current_selected_index)
Sound.play_save
SceneManager.return
end
end
#encoding:utf-8
#==============================================================================
# ■ SenceLoad
#------------------------------------------------------------------------------
#读档画面
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ●读档时存在选择的那一格,如果没有档案就放错误音效
#--------------------------------------------------------------------------
def deal_with_on_ok
if current_selected.does_not_exist
Sound.play_buzzer
return
end
easy_load(current_selected_index)
end
end
#encoding:utf-8
#==============================================================================
# ■ SenceMenu
#------------------------------------------------------------------------------
#渐变画面的设定
#==============================================================================
class Scene_Menu
def perform_transition
if Graphics.brightness == 0
Graphics.transition(0)
fadein(30)
else
super
end
end
end