コード: 全て選択
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# Kamesoft様の◆ 拡張ステータス画面 - KGC_ExtendedStatusScene ◆ VX ◆の
# プロフィール部分だけを引用したサンプル。未完成なのでこの様に改造して
# 完成させてください。
#==============================================================================
######################ここまでKamesoft様##########################
module CHARAPROFILE
# ◆ プロフィール
PROFILE = []
# ここから下に
# PROFILE[アクターID] = 'プロフィール'
# という書式で設定。
# 改行する場合は、改行したい位置に \| を入力。
PROFILE[1] =
'Name: \N[1]\|' +
'\C[2]プロフィールテスト\C[0]\|' +
'RTPのキャラ' +
'RUBY LOVEのRのRALPH'
PROFILE[2] =
'Name: \N[2]\|' +
'\C[2]プロフィールテスト\C[0]\|' +
'RTPのキャラ' +
'RUBY LOVEのUのURLIKA'
PROFILE[3] =
'Name: \N[3]\|' +
'\C[2]プロフィールテスト\C[0]\|' +
'RTPのキャラ' +
'RUBY LOVEのBのBENETT'
PROFILE[4] =
'Name: \N[4]\|' +
'\C[2]プロフィールテスト\C[0]\|' +
'RTPのキャラ' +
'RUBY LOVEのYのYLVAスペルあってる?'
end
######################ここまでKamesoft様##########################
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 544, 416)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 128, 0)
draw_actor_face(@actor, 8, 32)
draw_basic_info(128, 32)
draw_parameters(32, 160)
draw_exp_info(288, 32)
draw_equipments(288, 160)
draw_profile(0, 0) #プロフィール。変更しても位置は変わりません。
end
#--------------------------------------------------------------------------
# ● 基本情報の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x, y + WLH * 0)
draw_actor_state(@actor, x, y + WLH * 1)
draw_actor_hp(@actor, x, y + WLH * 2)
draw_actor_mp(@actor, x, y + WLH * 3)
end
#--------------------------------------------------------------------------
# ● 能力値の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_parameters(x, y)
draw_actor_parameter(@actor, x, y + WLH * 0, 0)
draw_actor_parameter(@actor, x, y + WLH * 1, 1)
draw_actor_parameter(@actor, x, y + WLH * 2, 2)
draw_actor_parameter(@actor, x, y + WLH * 3, 3)
end
#--------------------------------------------------------------------------
# ● 経験値情報の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
end
######################ここからKamesoft様引用##########################
#--------------------------------------------------------------------------
# ○ プロフィール描画
#--------------------------------------------------------------------------
def draw_profile(x, y)
profile = CHARAPROFILE::PROFILE[@actor.id]
return if profile == nil
self.contents.font.color = normal_color
profile.split(/\\\|/).each_with_index { |line, i|
draw_profile_text(0, WLH * i, line)
}
end
#--------------------------------------------------------------------------
# ○ プロフィールテキスト描画
# x, y : 描画先座標
# text : 描画テキスト
#--------------------------------------------------------------------------
def draw_profile_text(x, y, text)
buf = convert_special_characters(text)
while (c = buf.slice!(/./m)) != nil
case c
when "\x01" # \C[n] (文字色変更)
buf.sub!(/\[(\d+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (所持金表示)
n = $game_party.gold.to_s
cw = contents.text_size(n).width
contents.draw_text(x, y, cw + 8, WLH, n)
x += cw
else # 普通の文字
contents.draw_text(x, y, 40, WLH, c)
x += contents.text_size(c).width
end
end
contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# ○ 特殊文字の変換
# text : 変換対象テキスト
#--------------------------------------------------------------------------
def convert_special_characters(text)
buf = text.dup
buf.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
buf.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
buf.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
buf.gsub!(/\\C\[(\d+)\]/i) { "\x01[#{$1}]" }
buf.gsub!(/\\G/) { "\x02" }
buf.gsub!(/\\\\/) { "\\" }
return buf
end
######################ここまでKamesoft様##########################
#--------------------------------------------------------------------------
# ● 装備品の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
for i in 0..4
draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
end
end
end