1 2 Breaks- Save window 17/8/2012, 17:30
Hatsurugi
Diva
Olá mais uma vez a todos, hoje vim trazer este Spript que traz uma beleza a mais a sua Save window.
Espero que esteja útil aos senhores.
De sua atiradora
Hatsurugi
Caracteristicas:
- Modifica a tela de salvamento
- Desing agradavel.
Screenshot
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Script
- Código:
#==============================================================================
# ■ VXAce-RGSS3-20 セーブ画面-改2 [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# Modifica a window scene.
#==============================================================================
#==============================================================================
# ■ 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; @mmp = actor.mmp
@face_name = actor.face_name
@face_index = actor.face_index
@dead = 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
#--------------------------------------------------------------------------
# ● セーブファイル表示用の顔グラフィック画像情報
#--------------------------------------------------------------------------
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
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 file_index=(index)
return if @file_index == index
@file_index = index
header = DataManager.load_header(@file_index)
@actors = !header.nil? ? header[:actors] : []
@map_name = !header.nil? ? header[:map_name] : ""
@playtime = !header.nil? ? header[:playtime_s] : ""
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(200, 0, contents_width - 200)
draw_horz_line(line_height)
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)
draw_text(x, y, width, line_height, @playtime, 2)
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
Creditos:
- A Claimh: Por ciar o Script
- A Hatsurugi: Por postar no Templo.
Espero que esteja útil aos senhores.
De sua atiradora
Hatsurugi