#==============================================================================
# ■ VXAce-RGSS3-20 セーブ画面-改2 [Ver.1.1.0] by Claimh
#------------------------------------------------------------------------------
# セーブ画面の表示を改変します。
# (注)導入前のセーブデータは使えません
#------------------------------------------------------------------------------
#・ミッション名の更新
# $game_party.mission = "あらすじ"
#==============================================================================
#==============================================================================
# ■ SaveActor : セーブファイル用のダミーアクター
#==============================================================================
class SaveActor
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :name
attr_reader :level
attr_reader :hp
attr_reader :mp
attr_reader :mhp
attr_reader :mmp
attr_reader :face_name
attr_reader :face_index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(actor)
@name = actor.name
@level = actor.level
@hp = actor.hp; @mhp = actor.mhp
@mp = actor.mp; [url=home.php?mod=space&uid=474067]@MMP[/url] = actor.mmp
@face_name = actor.face_name
@face_index = actor.face_index
[url=home.php?mod=space&uid=89503]@deAd[/url] = actor.dead?
end
#--------------------------------------------------------------------------
# ● 戦闘不能判定
#--------------------------------------------------------------------------
def dead?
@dead
end
#--------------------------------------------------------------------------
# ● HP の割合を取得
#--------------------------------------------------------------------------
def hp_rate
@hp.to_f / @mhp
end
#--------------------------------------------------------------------------
# ● MP の割合を取得
#--------------------------------------------------------------------------
def mp_rate
@mmp > 0 ? @mp.to_f / @mmp : 0
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :mission # ミッション(ファイル画面表示用)
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_save initialize
def initialize
initialize_save
@mission = ""
end
#--------------------------------------------------------------------------
# ● セーブファイル表示用の顔グラフィック画像情報
#--------------------------------------------------------------------------
def member_for_savefile
members.collect { |actor| SaveActor.new(actor) }
end
end
#==============================================================================
# ■ DataManager
#==============================================================================
class << DataManager
#--------------------------------------------------------------------------
# ● セーブヘッダの作成
#--------------------------------------------------------------------------
alias make_save_header_faces make_save_header
def make_save_header
header = make_save_header_faces
header[:map_name] = $game_map.display_name
header[:actors] = $game_party.member_for_savefile
header[:mission] = $game_party.mission
header[:gold] = $game_party.gold
header
end
end
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化 [再定義]
# index : セーブファイルのインデックス
#--------------------------------------------------------------------------
def initialize(height, index)
super(0, index * height, window_width, height)
@file_index = index
refresh
@selected = false
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅
#--------------------------------------------------------------------------
def window_width
return 134
end
#--------------------------------------------------------------------------
# ● リフレッシュ [再定義]
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(normal_color)
name = Vocab::File + " #{@file_index + 1}"
draw_text(4, 0, 200, line_height, name)
@name_width = text_size(name).width
end
end
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveInfo < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, h)
@actors = []
super(x, h, Graphics.width - x, Graphics.height - h)
self.file_index = index
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
(contents_height - (line_height * 2)) / row_num
end
#--------------------------------------------------------------------------
# ● ウィンドウ内容の高さを計算
#--------------------------------------------------------------------------
def contents_height
height - standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 列数の取得
#--------------------------------------------------------------------------
def row_num
return 3
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 下端パディングの更新
#--------------------------------------------------------------------------
def update_padding_bottom
end
#--------------------------------------------------------------------------
# ● 横に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 16
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
return [@actors.size, 6].min
end
#--------------------------------------------------------------------------
# ● データ参照
#--------------------------------------------------------------------------
def data(header, symbol, default)
(header.nil? or header[symbol].nil?) ? default : header[symbol]
end
#--------------------------------------------------------------------------
# ● ファイル変更
#--------------------------------------------------------------------------
def file_index=(index)
return if @file_index == index
@file_index = index
header = DataManager.load_header(@file_index)
@actors = data(header, :actors, [])
@map_name = data(header, :map_name, "")
@playtime = data(header, :playtime_s, "00:00:00")
@mission = data(header, :mission, "")
@gold = data(header, :gold, 0)
create_contents
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
super
if @actors.empty? or @actors.nil?
draw_text(0, 0, contents_width, contents_height, "- empty -", 1)
return
end
draw_text(0, 0, contents_width, line_height, @map_name)
draw_playtime(contents_width - 128, 0, 128)
draw_text_ex(0, line_height, @mission)
draw_gold(contents_width - 128, line_height, 128)
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
return if @actors.empty? or @actors.nil?
actor = @actors[index]
rect = item_rect(index)
rect.y += line_height * 2
draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
draw_actor_name(actor, rect.x + 100, rect.y+line_height*0)
draw_actor_level(actor, rect.x + 100, rect.y+line_height*1)
w = [124, rect.width - 100].min
draw_actor_hp(actor, rect.x + 100, rect.y+line_height*2, w)
draw_actor_mp(actor, rect.x + 100, rect.y+line_height*3, w)
end
#--------------------------------------------------------------------------
# ● プレイ時間の描画
#--------------------------------------------------------------------------
def draw_playtime(x, y, width)
change_color(system_color)
contents.font.size -= 8
draw_text(x, y+4, width, line_height, "TIME")
contents.font.size += 8
change_color(normal_color)
draw_text(x, y, width, line_height, @playtime, 2)
end
#--------------------------------------------------------------------------
# ● 所持金の描画
#--------------------------------------------------------------------------
def draw_gold(x, y, width)
draw_currency_value(@gold, Vocab::currency_unit, x, y, width)
end
#--------------------------------------------------------------------------
# ● 水平線の描画
#--------------------------------------------------------------------------
def draw_horz_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(0, line_y, contents_width, 2, line_color)
end
#--------------------------------------------------------------------------
# ● 水平線の色を取得
#--------------------------------------------------------------------------
def line_color
color = normal_color
color.alpha = 48
color
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File < Scene_MenuBase
#--------------------------------------------------------------------------
# ● セーブファイルウィンドウの作成
#--------------------------------------------------------------------------
alias create_savefile_windows_save create_savefile_windows
def create_savefile_windows
create_savefile_windows_save
@info_window = Window_SaveInfo.new(@savefile_windows[0].window_width, @help_window.height)
end
#--------------------------------------------------------------------------
# ● 選択状態の初期化
#--------------------------------------------------------------------------
alias init_selection_save init_selection
def init_selection
init_selection_save
@info_window.file_index = @index
end
#--------------------------------------------------------------------------
# ● 画面内に表示するセーブファイル数を取得
#--------------------------------------------------------------------------
def visible_max
return @savefile_viewport.rect.height / @help_window.height
end
#--------------------------------------------------------------------------
# ● カーソルの更新
#--------------------------------------------------------------------------
alias update_cursor_save update_cursor
def update_cursor
update_cursor_save
@info_window.file_index = @index
end
end