=begin #-----------------------------------------------------------------------
●セーブレイアウト【RGSS3 by Declare War】
セーブ画面のレイアウトを変更する
(VXのネオメモさんのセーブレイアウトカスタム版 風)
【利用規約】
著作権明記と利用報告は不要、加工自由、転載と配布は禁止
=end #-------------------------------------------------------------------------
module Declare_War
module Save_Layout
# 画像の設定(使わないなら""のまま、使うならGraphics/Pictureに入れる)
Cursor_Picture = "" # カーソル画像
Back_Picture = "" # 背景画像
# 右のウィンドウの不透明度(0で枠だけ)
Back_Opacity = 128
# 色の設定
Cursor = Color.new(196, 224, 255, 196) # カーソル(画像無しのとき使う)
Base = Color.new(0, 0, 0) # ベース色
Back = Color.new(0, 0, 128, 64) # コマンド背景色
Text = Color.new(0, 208, 0) # テキスト文字(マップ名とか)
Time = Color.new(255, 255, 255) # 時間文字色
Help = Color.new(0 ,0, 0, 80) # ヘルプの背景色
end
end
class << DataManager
#--------------------------------------------------------------------------
# ● セーブヘッダの作成(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_make_save_header make_save_header
def make_save_header
header = custom_save_layout_make_save_header
header[:leader] = $game_party.leader
header[:map_name] = $game_map.display_name
header
end
end
class Sprite_Save_Cursol < Sprite
#--------------------------------------------------------------------------
# ● インクルード
#--------------------------------------------------------------------------
include Declare_War::Save_Layout
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(nil)
self.x = 12
self.z = 90
create_cursol
@count = 0
end
#--------------------------------------------------------------------------
# ● カーソルを作成
#--------------------------------------------------------------------------
def create_cursol
if !Cursor_Picture.empty?
return self.bitmap = Cache.picture(Cursor_Picture)
end
self.bitmap = Bitmap.new(304, 26)
color = Cursor.dup
color.alpha = 128
bitmap.fill_rect(1, 1, 275, 24, color)
bitmap.fill_rect(0, 1, 1, 24, Cursor)
bitmap.fill_rect(1, 25, 302, 1, Cursor)
bitmap.fill_rect(288, 24, 12, 1, Cursor)
bitmap.fill_rect(287, 23, 10, 1, Cursor)
bitmap.fill_rect(287, 22, 7, 1, Cursor)
bitmap.fill_rect(286, 21, 5, 1, Cursor)
bitmap.fill_rect(286, 20, 2, 1, Cursor)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_count
end
#--------------------------------------------------------------------------
# ● 点滅の更新
#--------------------------------------------------------------------------
def update_count
if @count < 160
self.opacity = 255 - @count
@count += 4
else
self.opacity = @count - 64
@count += 4
end
@count = 0 if @count >= 320
end
end
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ● インクルード
#--------------------------------------------------------------------------
include Declare_War::Save_Layout
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :header
#--------------------------------------------------------------------------
# ● オブジェクト初期化(overwrite)
#--------------------------------------------------------------------------
def initialize(height, index)
super(0, calc_y(index), 300, window_height)
self.opacity = 0
@file_index = index
refresh
@selected = false
end
#--------------------------------------------------------------------------
# ● ウィンドウの縦幅
#--------------------------------------------------------------------------
def window_height
26 + standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 計算したY座標を取得
#--------------------------------------------------------------------------
def calc_y(index)
-standard_padding + index * window_height - index * standard_padding * 2
end
#--------------------------------------------------------------------------
# ● ヘッダーをロード
#--------------------------------------------------------------------------
def load_header
@header = DataManager.load_header(@file_index)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_back_graphic
load_header
contents.font.size = 20
draw_file_info
draw_playtime(72, 0, contents.width - 76, 2)
draw_mapname(72, 0, 160, 0)
end
#--------------------------------------------------------------------------
# ● 背景の描画
#--------------------------------------------------------------------------
def draw_back_graphic
contents.fill_rect(0, 0, contents.width, 1, Base)
contents.fill_rect(0, 23, contents.width, 1, Base)
contents.fill_rect(66, 1, 1, 22, Base)
color = Base.dup
color.alpha = 0
contents.gradient_fill_rect(0, 1, 64, 22, color, Base)
contents.fill_rect(67, 1, contents.width - 67, 22, Back)
end
#--------------------------------------------------------------------------
# ● ファイル情報の描画
#--------------------------------------------------------------------------
def draw_file_info
change_color(normal_color)
if @file_index == 0 # 改造处
name = "自动存档" # 改造处
else # 改造处
name = "File" + " #{@file_index}"
end #改造处
draw_text(4, 0, 200, line_height, name)
@name_width = text_size(name).width
end
#--------------------------------------------------------------------------
# ● プレイ時間の描画(overwrite)
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
return if !@header
change_color(Time)
draw_text(x, y, width, line_height, @header[:playtime_s], align)
end
#--------------------------------------------------------------------------
# ● マップ名の描画
#--------------------------------------------------------------------------
def draw_mapname(x, y, width, align)
return if !@header || !@header[:map_name]
change_color(Text)
draw_text(x, y, width, line_height, @header[:map_name], align)
end
#--------------------------------------------------------------------------
# ● カーソルの更新(overwrite)
#--------------------------------------------------------------------------
def update_cursor
end
end
class Window_Save_Leader < Window_Base
#--------------------------------------------------------------------------
# ● インクルード
#--------------------------------------------------------------------------
include Declare_War::Save_Layout
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(actor)
super(316, 56, 212, 344)
self.back_opacity = Back_Opacity
refresh(actor)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor)
contents.clear
draw_leader_info(actor)
end
#--------------------------------------------------------------------------
# ● リーダーの情報を描画
#--------------------------------------------------------------------------
def draw_leader_info(actor)
return if !actor
draw_actor_battler(actor)
draw_actor_face(actor, center_x(96), 4)
draw_actor_simple_status(actor, 0, 98)
draw_param(actor, 174)
end
#--------------------------------------------------------------------------
# ● 中心を取得
#--------------------------------------------------------------------------
def center_x(num)
(contents.width - num) / 2
end
#--------------------------------------------------------------------------
# ● アクターのバトラーグラフィックの描画
#--------------------------------------------------------------------------
def draw_actor_battler(actor)
draw_battler(actor.battler_name, actor.battler_hue)
end
#--------------------------------------------------------------------------
# ● バトラーグラフィックの描画
#--------------------------------------------------------------------------
def draw_battler(battler_name, battler_hue)
bmp = Cache.battler(battler_name, battler_hue)
rect = Rect.new(0, 0, bmp.width, bmp.height)
x = (contents.width - bmp.width) / 2
y = contents.height - bmp.height
contents.blt(x, y, bmp, rect)
end
#--------------------------------------------------------------------------
# ● シンプルなステータスの描画
#--------------------------------------------------------------------------
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor, x, y)
draw_actor_level(actor, x+120, y)
draw_actor_hp(actor, x, y + line_height * 1)
draw_actor_mp(actor, x, y + line_height * 2)
end
#--------------------------------------------------------------------------
# ● パラメータの描画
#--------------------------------------------------------------------------
def draw_param(actor, base_y)
space = 16
str_width = contents.width - space
(2..7).each do |i|
y = base_y + (i - 2) * line_height
change_color(system_color)
draw_text(space / 2, y, str_width, 24, $data_system.terms.params[i])
change_color(normal_color)
draw_text(space / 2, y, str_width, 24, actor.param(i).to_s, 2)
end
end
end
class Window_LineHelp < Window_Base
#--------------------------------------------------------------------------
# ● 定数
#--------------------------------------------------------------------------
BACK_COLOR = Declare_War::Save_Layout::Help
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(-16, 0, 576, 24 + 24)
self.opacity = 0
end
#--------------------------------------------------------------------------
# ● テキスト設定
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
contents.clear
refresh(text)
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(text)
contents.fill_rect(0, 12, contents.width, 12, BACK_COLOR)
change_color(normal_color)
contents.draw_text(20, 0, width - 72, 24, text)
@text = text
end
end
class Scene_File
#--------------------------------------------------------------------------
# ● 定数
#--------------------------------------------------------------------------
Back_Picture = Declare_War::Save_Layout::Back_Picture
#--------------------------------------------------------------------------
# ● 画面内に表示するセーブファイル数を取得(overwrite)
#--------------------------------------------------------------------------
def visible_max
12
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウの作成(overwrite)
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_LineHelp.new
@help_window.set_text(help_window_text)
end
#--------------------------------------------------------------------------
# ● データウィンドウの作成
#--------------------------------------------------------------------------
def create_data_window
actor = @savefile_windows[index].header[:leader] rescue nil
@data_window = Window_Save_Leader.new(actor)
end
#--------------------------------------------------------------------------
# ● セーブファイルビューポートの作成(overwrite)
#--------------------------------------------------------------------------
def create_savefile_viewport
@savefile_viewport = Viewport.new
@savefile_viewport.rect.y = 56
@savefile_viewport.rect.height = 312
end
#--------------------------------------------------------------------------
# ● 背景の作成(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_create_background create_background
def create_background
if !Back_Picture.empty?
@background_sprite = Cache.picture(Back_Picture)
else
custom_save_layout_create_background
end
end
#--------------------------------------------------------------------------
# ● 開始処理(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_start start
def start
custom_save_layout_start
create_data_window
create_cursol
end
#--------------------------------------------------------------------------
# ● カーソルの作成
#--------------------------------------------------------------------------
def create_cursol
@cursol = Sprite_Save_Cursol.new
set_cursol_y
end
#--------------------------------------------------------------------------
# ● カーソルの高さ調節
#--------------------------------------------------------------------------
def set_cursol_y
@cursol.y = 55 + (@index - top_index) * 26
end
#--------------------------------------------------------------------------
# ● 終了処理(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_terminate terminate
def terminate
custom_save_layout_terminate
@cursol.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_update update
def update
custom_save_layout_update
set_cursol_y
@cursol.update
end
#--------------------------------------------------------------------------
# ● カーソルの更新(alias)
#--------------------------------------------------------------------------
alias custom_save_layout_update_cursor update_cursor
def update_cursor
last_index = @index
custom_save_layout_update_cursor
data_window_refresh if last_index != @index
end
#--------------------------------------------------------------------------
# ● データウィンドウのリフレッシュ
#--------------------------------------------------------------------------
def data_window_refresh
actor = @savefile_windows[index].header[:leader] rescue nil
@data_window.refresh(actor)
end
end