#==============================================================================
# ++ メッセージふきだし表示 ver. 2.01 ++
# Script by パラ犬
# [url=http://2d6.parasite.jp/]http://2d6.parasite.jp/[/url]
#------------------------------------------------------------------------------
# ふきだし表示をするには、
# テール用画像「(スキン名)-top」「(スキン名)-under」を
# 「Graphics/Windowskins」フォルダにインポートしておく必要があります。
#------------------------------------------------------------------------------
#
# [ふきだし表示の使い方]
# イベントコマンド「スクリプト」で「$mes_id」にイベントIDを代入することで
# そのイベントにふきだしがポップするようになります。
# (記述例: $mes_id=4 )
# IDに-1を代入するとプレイヤー、0でそのイベント自身。
# nilまたは""を代入すると、通常のメッセージ表示に戻ります。
# 表示位置はイベント「文章オプション」で変更できます。
# 表示位置に「中央」を指定すると、イベントの位置に関係なく
# 画面中央に表示されます。
#
# [名前ウインドウの使い方]
# イベントコマンド「スクリプト」で「$mes_name」に文字列を代入することで
# 名前ウインドウを表示します。
# (記述例: $mes_name="アルシェス" )
# 制御文字 \N[n] を使用する場合、\は\\と記述してください。
# (記述例: $mes_name="\\N[1]" $mes_name="\\N[\\V[1]]")
# ""またはnilを代入すると、非表示になります。
#
# 二つの機能は独立していますので、それぞれ単体で使えます。
# $mes_id=(ID) + $mes_name="名前" :ふきだし表示 + 名前ウインドウ
# $mes_id=(ID) + $mes_name="" :ふきだし表示 (名前なし)
# $mes_id=nil + $mes_name="名前" :デフォルトウインドウ + 名前ウインドウ
# $mes_id=nil + $mes_name="" :デフォルトウインドウ (名前なし)
#
# [メッセージ表示スピードの変更法]
# イベントコマンド「スクリプト」で「$mes_speed」に数値を代入します。
# 0を代入すると瞬間表示になります。
# (記述例: $mes_speed = 1 )
#
# [オートメッセージ送り]
# イベントコマンド「スクリプト」で「$mes_auto」に数値を代入します。
# 数値はメッセージ描画終了後のウエイトのフレーム数です。
# nilを代入すると、オートモードが解除されます。
#
# [追加制御文字]
# \I[ファイル名] アイコンの描画
# 「Graphics/Icons」内の画像を表示します。( 記述例:\I[001-Weapon01] )
# \S[n] メッセージスピードの変更
# \size[n] フォントサイズの変更
#
#==============================================================================
module FUKI
# スキンの設定
# ウインドウスキンと同じものを使うときは「""」
FUKI_SKIN_NAME = "001-Blue01" # ふきだし用スキン
NAME_SKIN_NAME = "001-Blue01" # 名前表示用スキン
# フォントサイズ
MES_FONT_SIZE = 22 # ふきだし
NAME_FONT_SIZE = 14 # 名前ウインドウ
# 文字色
#( Color.new(0, 0, 0, 0)を指定すると、通常文字色を使用します )
FUKI_COLOR = Color.new(255, 255, 255, 255) # ふきだしウインドウ
NAME_COLOR = Color.new(255, 255, 255, 255) # 名前ウインドウ
# ウインドウの透明度
FUKI_OPACITY = 255 # ふきだしウインドウ
MES_OPACITY = 255 # 通常のメッセージウインドウ
NAME_OPACITY = 255 # 名前ウインドウ
# 名前ウインドウの相対位置
NAME_SHIFT_X = 0 # 横位置
NAME_SHIFT_Y = 16 # 縦位置
# 画面上下からウインドウがはみ出す時は、
# 自動で表示位置(上下)をチェンジ( true / false )
POS_FIX = true
# 画面の一番端ではふきだしを少しずらす
# 角の丸いスキンを使っていて、枠の角がふきだしと重なる場合に true にする
CORNER_SHIFT = false
SHIFT_PIXEL = 4 # trueの時にずらすピクセル数
# キャラクターの縦のサイズ
CHARACTOR_HEIGHT = 48
# ふきだしの相対位置(縦位置)
POP_SHIFT_TOP = 0 # 表示位置が上のとき
POP_SHIFT_UNDER = -16 # 表示位置が下のとき
# メッセージ表示速度(数字が小さいほど速い。0で瞬間表示)
# $mes_speedに数値を代入することで、ゲーム中に変更可。
MES_SPEED = 1
# メッセージスキップを使用するか
MES_SKIP = true #( true:有効 / false:無効 )
# メッセージスキップに使うボタン(表記方法は、Input::(ボタン))
#(キーボードとの対応表はツクールのヘルプ「ゲームの操作方法」にあります)
MES_SKIP_KEY = Input::A
# メッセージスキップ禁止イベントスイッチID
# (イベントコマンド「スイッチの操作」でこの番号のスイッチをONにしている間は
# メッセージスキップを機能を無効にします)
NO_MES_SKIP_SWITCH = 999
end
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
# 文章表示に使うメッセージウィンドウです。
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias alias_para_fuki_initialize initialize
def initialize
# エイリアスを呼び戻す
alias_para_fuki_initialize
# 変数をセット
[url=home.php?mod=space&uid=133944]@w[/url] = 0
@h = 0
[url=home.php?mod=space&uid=36110]@Wait[/url] = 0
@dx = 0
@dy = 0
@dh = 0
$mes_speed = FUKI::MES_SPEED
end
#--------------------------------------------------------------------------
# ● ウィンドウの位置と不透明度の設定
#--------------------------------------------------------------------------
alias alias_para_fuki_reset_window reset_window
def reset_window
# エイリアスを呼び戻す
alias_para_fuki_reset_window
self.back_opacity = FUKI::MES_OPACITY
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# ふきだしモードではイベントの動きに追従
if @tale != nil
pos = get_fuki_pos(self.width, self.height)
self.x = pos[0]
self.y = pos[1]
tale_pos = get_tale_pos
@tale.x = tale_pos[0]
@tale.y = tale_pos[1]
if @name_win != nil
name_height = FUKI::NAME_FONT_SIZE
@name_win.x = self.x + FUKI::NAME_SHIFT_X
@name_win.y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
@name_contents.x = @name_win.x + 12
@name_contents.y = @name_win.y + 8
end
end
# メッセージスキップ
if mes_skip?
self.contents_opacity = 255
if @name_win != nil
@name_win.opacity = 255
end
if @tale != nil
@tale.opacity = 255
end
if @input_number_window != nil
@input_number_window.contents_opacity = 255
end
@fade_in = false
end
# フェードインの場合
if @fade_in
self.contents_opacity += 24
if @name_win != nil
@name_win.opacity += 24
end
if @tale != nil
@tale.opacity += 24
end
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end
# メッセージ表示中の場合
if @contents_drawing
# 一文字ずつ描画
refresh_drawtext
return
end
# 数値入力中の場合
if @input_number_window != nil
@input_number_window.update
# 決定
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# 数値入力ウィンドウを解放
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end
# メッセージ表示終了の場合
if @contents_showing_end
# メッセージスキップ判定
if mes_skip?
# 選択肢の表示中でなければメッセージウインドウを閉じる
if $game_temp.choice_max == 0
terminate_message
# ふきだしを破棄
del_fukidasi
return
end
end
# オートモード
if @mes_auto != nil
if @mes_auto <= 0
terminate_message
# ふきだしを破棄
del_fukidasi
@mes_auto = nil
else
@mes_auto -= 1
end
end
# 選択肢の表示中でなければポーズサインを表示
# ふきだしモードでは非表示
if $game_temp.choice_max == 0 and @tale == nil
self.pause = true
else
self.pause = false
end
# キャンセル
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# 決定
if Input.trigger?(Input::C) and $mes_auto == nil
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
# ふきだしを破棄
del_fukidasi
end
return
end
# フェードアウト中以外で表示待ちのメッセージか選択肢がある場合
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
refresh_create
if @name_win != nil
@name_win.opacity = 0
end
if @tale != nil
@tale.opacity = 0
end
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0
if @input_number_window != nil
@input_number_window.contents_opacity = 0
end
@fade_in = true
@mes_auto = $mes_auto
return
end
# 表示すべきメッセージがないが、ウィンドウが可視状態の場合
if self.visible
@fade_out = true
self.opacity -= 48
if @name_win != nil
@name_win.opacity -= 48
end
if @tale != nil
@tale.opacity -= 48
end
if self.opacity == 0
self.visible = false
@fade_out = false
$game_temp.message_window_showing = false
del_fukidasi
end
return
end
end
#--------------------------------------------------------------------------
# ● メッセージ終了処理
#--------------------------------------------------------------------------
alias alias_para_fuki_terminate_message terminate_message
def terminate_message
# エイリアスを呼び戻す
alias_para_fuki_terminate_message
@contents_showing_end = false
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if @index >= 0
n = $game_temp.choice_start + @index
font_size = self.contents.font.size
self.cursor_rect.set(8, n*(font_size+10)-5, @cursor_width, (font_size+10))
else
self.cursor_rect.empty
end
end
#--------------------------------------------------------------------------
# ○ メッセージスキップ有効判定
#--------------------------------------------------------------------------
def mes_skip?
if FUKI::MES_SKIP == true and Input.repeat?(FUKI::MES_SKIP_KEY) and $game_switches[FUKI::NO_MES_SKIP_SWITCH] == false
return true
else
return false
end
end
#--------------------------------------------------------------------------
# ○ サイズを決定してウインドウを作成
#--------------------------------------------------------------------------
def refresh_create
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = FUKI::MES_FONT_SIZE
# ウインドウサイズを取得
get_windowsize
w = [url=home.php?mod=space&uid=133944]@w[/url] + 32 + 8
h = @h + 26
# ふきだしウインドウを作成
set_fukidasi(self.x, self.y, w, h)
# 名前ウインドウを作成
set_namewindow
# メッセージ表示用変数の初期化
@dx = @dy = @dh = @max_font_h = 0
@cursor_width = 0
@contents_drawing = true
# メッセージスピードの初期化
@mes_speed = $mes_speed
# フォントサイズの初期化
self.contents.font.size = FUKI::MES_FONT_SIZE
@max_font_h = self.contents.font.size
# 文字描画
refresh_drawtext
end
#--------------------------------------------------------------------------
# ○ 一文字ずつ描画
#--------------------------------------------------------------------------
def refresh_drawtext
if $game_temp.message_text != nil
# メッセージスキップがオンなら
if mes_skip?
# 描画が終わるまで描画処理をループ
while $game_temp.message_text != ""
draw_massage
end
# メッセージスピードが0なら
elsif @mes_speed == 0
# 描画が終わるかメッセージスピードが変更されるまで描画処理をループ
while $game_temp.message_text != "" and @mes_speed == 0
draw_massage
end
else
if [url=home.php?mod=space&uid=36110]@Wait[/url] > 0
@wait -= 1
elsif @wait == 0
# 描画処理
draw_massage
@wait = @mes_speed
end
end
end
# 描画終了
if $game_temp.message_text == ""
draw_opt_text
@contents_showing_end = true
@contents_drawing = false
end
end
#--------------------------------------------------------------------------
# ○ ウインドウサイズを取得
#--------------------------------------------------------------------------
def get_windowsize
x = y = 0
@h = @w = 0
max_font_h = self.contents.font.size
@cursor_width = 0
# 選択肢なら字下げを行う
if $game_temp.choice_start == 0
x = 16
end
# 表示待ちのメッセージがある場合
if $game_temp.message_text != nil
text = $game_temp.message_text.clone
# 制御文字処理
begin
last_text = text.clone
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until text == last_text
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
# 便宜上、"\\\\" を "\000" に変換
text.gsub!(/\\\\/) { "\000" }
# "\\C" を "\001" に、"\\G" を "\002" に変換
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
text.gsub!(/\\[Gg]/) { "\002" }
# "\\I" を "\003" に変換
text.gsub!(/\\[Ii]\[(.*?)\]/) { "\003[#{$1}]" }
# "\\S" を "\004" に変換
text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\004[#{$1}]" }
# "\\size" を "\005" に変換
text.gsub!(/\\size\[([0-9]+)\]/) { "\005[#{$1}]" }
# c に 1 文字を取得 (文字が取得できなくなるまでループ)
while ((c = text.slice!(/./m)) != nil)
# \\ の場合
if c == "\000"
# 本来の文字に戻す
c = "\\"
end
# \C[n] または \G の場合 または \S[n] のとき
if c == "\001" or c == "\002" or c == "\004"
# 次の文字へ
next
end
# 改行文字の場合
if c == "\n"
# y に 1 を加算
y += 1
# 縦横サイズを取得
@h += max_font_h + 10
max_font_h = 0
@w = x > @w ? x : @w
if y >= $game_temp.choice_start
@w = x + 8 > @w ? x + 8 : @w
end
x = 0
# 選択肢なら字下げを行う
if y >= $game_temp.choice_start
x = 8
end
# 次の文字へ
next
end
# \I[ファイル名] の場合
if c == "\003"
text.sub!(/\[(.*?)\]/, "")
bitmap = RPG::Cache.icon($1)
# x にアイコンの幅を加算
x += bitmap.width
# 次の文字へ
next
end
# \size[n] の場合
if c == "\005"
text.sub!(/\[([0-9]+)\]/, "")
# 文字サイズを変更
self.contents.font.size = $1.to_i
# 最大縦幅を取得
if self.contents.font.size > max_font_h
max_font_h = self.contents.font.size
end
end
# x に文字の幅を加算
x += self.contents.text_size(c).width
# 最大縦幅を取得
if self.contents.font.size > max_font_h
max_font_h = self.contents.font.size
end
end
end
# 文字サイズを戻す
self.contents.font.size = FUKI::MES_FONT_SIZE
# 数値入力の場合
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@h += 1
x = digits_max * self.contents.font.size + 16
@w = x > @w ? x : @w
end
end
#--------------------------------------------------------------------------
# ○ 描画処理
#--------------------------------------------------------------------------
def draw_massage
# 表示待ちのメッセージがある場合
if $game_temp.message_text != nil
text = $game_temp.message_text
# 制御文字処理
begin
last_text = text.clone
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until text == last_text
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
# 便宜上、"\\\\" を "\000" に変換
text.gsub!(/\\\\/) { "\000" }
# "\\C" を "\001" に、"\\G" を "\002" に変換
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
text.gsub!(/\\[Gg]/) { "\002" }
# "\\I" を "\003" に変換
text.gsub!(/\\[Ii]\[(.*?)\]/) { "\003[#{$1}]" }
# "\\S" を "\004" に変換
text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\004[#{$1}]" }
# "\\size" を "\005" に変換
text.gsub!(/\\size\[([0-9]+)\]/) { "\005[#{$1}]" }
# c に 1 文字を取得
if ((c = text.slice!(/./m)) != nil)
# 選択肢の場合
if @dy >= $game_temp.choice_start
# 字下げを行う
@dx = 8
# 文字を描画
font_size = self.contents.font.size
# x に描画した文字の幅を加算
@dx += self.contents.text_size(c).width
# ループ
while ((c = text.slice!(/./m)) != "\n")
# 文字を描画
font_size = self.contents.font.size
@max_font_h = font_size
# x に描画した文字の幅を加算
@dx += self.contents.text_size(c).width
end
if c == "\n"
# カーソルの幅を更新
@cursor_width = [@cursor_width, @dx].max
# フォントの最大の高さを加算
@dh += @max_font_h + 10
@max_font_h = self.contents.font.size
@dx = 0
end
return
end
# \\ の場合
if c == "\000"
# 本来の文字に戻す
c = "\\"
end
# \C[n] の場合
if c == "\001"
# 文字色を変更
text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
return
end
# \G の場合
if c == "\002"
# ゴールドウィンドウを作成
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
if $game_temp.in_battle
@gold_window.y = 192
else
@gold_window.y = self.y >= 128 ? 32 : 384
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
return
end
# 改行文字の場合
if c == "\n"
# y に 1 を加算
@dy += 1
@dx = 0
# フォントの最大の高さを加算
@dh += @max_font_h + 10
@max_font_h = 0
return
end
# \I[ファイル名] の場合
if c == "\003"
text.sub!(/\[(.*?)\]/, "")
bitmap = RPG::Cache.icon($1)
font_size = FUKI::MES_FONT_SIZE
# アイコンを描画
# x に描画したアイコンの幅を加算
@dx += bitmap.width
# 最大縦幅を取得
if self.contents.font.size > @max_font_h
@max_font_h = bitmap.height
end
return
end
# \S[n] の場合
if c == "\004"
text.sub!(/\[([0-9]+)\]/, "")
# 描画スピードを変更
@mes_speed = $1.to_i
return
end
# \size[n] の場合
if c == "\005"
text.sub!(/\[([0-9]+)\]/, "")
c = ""
# 文字サイズを変更
self.contents.font.size = $1.to_i
end
# 文字を描画
font_size = self.contents.font.size
# x に描画した文字の幅を加算
@dx += self.contents.text_size(c).width
# 文字の最大縦幅を取得
if self.contents.font.size > @max_font_h
@max_font_h = self.contents.font.size
end
end
end
end
#--------------------------------------------------------------------------
# ○ 選択肢と数値入力を有効に
#--------------------------------------------------------------------------
def draw_opt_text
# 選択肢の場合
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active = true
self.index = 0
end
# 数値入力の場合
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
end
#--------------------------------------------------------------------------
# ○ ふきだしを表示
#--------------------------------------------------------------------------
def set_fukidasi(x, y, width, height)
# $mes_id が空のときはふきだしを表示しない
if $mes_id == nil or $mes_id == ""
del_fukidasi
reset_window
else
# ポーズサインを非表示
self.pause = false
# 位置を取得
pos = get_fuki_pos(width, height)
x = pos[0]
y = pos[1]
skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
# ふきだし用メッセージウインドウを作成
self.windowskin = RPG::Cache.windowskin(skin)
self.x = x
self.y = y
self.height = height
self.width = width
self.contents.dispose
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = FUKI::FUKI_OPACITY
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = FUKI::MES_FONT_SIZE
# ふきだしのテールを描画
if $game_system.message_frame == 0
# 位置を取得
tale_pos = get_tale_pos
@tale = Sprite.new
case @message_position
when 0 # 上
@tale.bitmap = RPG::Cache.windowskin(skin + "-top")
@tale.x = tale_pos[0]
@tale.y = tale_pos[1]
@tale.z = self.z + 1
when 1 # 中
@tale.dispose
@tale = nil
when 2 # 下
@tale.bitmap = RPG::Cache.windowskin(skin + "-under")
@tale.x = tale_pos[0]
@tale.y = tale_pos[1]
@tale.z = self.z + 1
end
end
end
end
#--------------------------------------------------------------------------
# ○ ふきだしの位置を計算
#--------------------------------------------------------------------------
def get_fuki_pos(width, height)
# キャラクターを取得
@character = get_character($mes_id)
if @character == nil
# キャラクターが存在しないときは通常のメッセージウインドウに
del_fukidasi
reset_window
return
end
# 座標処理
x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
# はみ出すときは画面内に収まるように移動
if x + width > 640
x = 640 - width
elsif x < 0
x = 0
end
# ウインドウの位置を決定
case $game_system.message_position
when 0 # 上
y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
when 1 # 中
y = (480 - height) / 2
x = (640 - width) / 2
when 2 # 下
y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
end
#メッセージポジション一時記憶
@message_position = $game_system.message_position
# 画面外にはみ出す時はウインドウの上下をチェンジ
if FUKI::POS_FIX
case @message_position
when 0 # 上
if y <= 0
@message_position = 2
y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 + FUKI::POP_SHIFT_UNDER
end
when 2 # 下
if y + height >= 480
@message_position = 0
y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 - height + 32 - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
end
end
end
return [x,y]
end
#--------------------------------------------------------------------------
# ○ テールの位置を計算
#--------------------------------------------------------------------------
def get_tale_pos
case @message_position
when 0 # 上
# 座標処理
x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
# 画面端では位置をずらす
if FUKI::CORNER_SHIFT
if x == 0
x = FUKI::SHIFT_PIXEL
elsif x == 640 - 32
x = 640 - 32 - FUKI::SHIFT_PIXEL
end
end
y = self.y + self.height - 16
when 1 # 中
x = nil
y = nil
when 2 # 下
# 座標処理
x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
# 画面端では位置をずらす
if FUKI::CORNER_SHIFT
if x == 0
x = FUKI::SHIFT_PIXEL
elsif @tale.x == 640 - 32
x = 640 - 32 - FUKI::SHIFT_PIXEL
end
end
y = self.y - 16
end
return [x,y]
end
#--------------------------------------------------------------------------
# ○ 名前ウインドウを表示
#--------------------------------------------------------------------------
def set_namewindow
# $mes_name が空のときは名前ウインドウを表示しない
if $mes_name == nil or $mes_name == ""
return
else
# 変数をセット
mes_name = $mes_name
# 制御文字処理
begin
last_text = mes_name.clone
mes_name.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until mes_name == last_text
mes_name.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
name_height = FUKI::NAME_FONT_SIZE
name_x = self.x + FUKI::NAME_SHIFT_X
name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
# 名前ウインドウ(枠のみ)を作成
@name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
@name_win.windowskin = RPG::Cache.windowskin(skin)
@name_win.back_opacity = FUKI::NAME_OPACITY
@name_win.z = self.z + 1
# 余白をwindowクラスの限界よりも小さくするため、二重構造に
@name_contents = Sprite.new
@name_contents.x = name_x + 12
@name_contents.y = name_y + 8
@name_contents.bitmap = Bitmap.new(name_width, name_height)
@name_contents.z = @name_win.z + 2
# 文字色の設定
nil_color = Color.new(0,0,0,0)
if FUKI::NAME_COLOR != nil_color
@name_contents.bitmap.font.color = FUKI::NAME_COLOR
else
@name_contents.bitmap.font.color = normal_color
end
@name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
# ウインドウサイズを調整
rect = @name_contents.bitmap.text_size(mes_name)
@name_win.width = rect.width + 32
# 名前を描画
@name_contents.bitmap.draw_text(rect, mes_name)
end
end
#--------------------------------------------------------------------------
# ○ ふきだしと名前ウインドウを破棄
#--------------------------------------------------------------------------
def del_fukidasi
if @tale != nil
@tale.dispose
@tale = nil
end
if @name_win != nil
@name_win.dispose
@name_win = nil
@name_contents.dispose
@name_contents = nil
end
self.opacity = 0
self.x = 80
self.width = 480
self.height = 160
self.contents.dispose
self.contents = Bitmap.new(width - 32, height - 32)
self.pause = true
end
#--------------------------------------------------------------------------
# ○ キャラクターの取得
# parameter : パラメータ
#--------------------------------------------------------------------------
def get_character(parameter)
# パラメータで分岐
case parameter
when -1 # プレイヤー
return $game_player
when 0 # このイベント
events = $game_map.events
return events == nil ? nil : events[$active_event_id]
else # 特定のイベント
events = $game_map.events
return events == nil ? nil : events[parameter]
end
end
#--------------------------------------------------------------------------
# ● 通常文字色の取得
#--------------------------------------------------------------------------
def normal_color
# ふきだしモード時に設定を適用
if $mes_id != nil and $mes_id != ""
nil_color = Color.new(0,0,0,0)
if FUKI::FUKI_COLOR != nil_color
color = FUKI::FUKI_COLOR
else
color = super
end
return color
else
# 非ふきだし時には通常文字色
return super
end
end
end
#==============================================================================
# ■ Window_InputNumber
#==============================================================================
class Window_InputNumber < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# digits_max : 桁数
#--------------------------------------------------------------------------
def initialize(digits_max)
@digits_max = digits_max
[url=home.php?mod=space&uid=27178]@Number[/url] = 0
# 数字の幅からカーソルの幅を計算 (0~9 は等幅と仮定)
dummy_bitmap = Bitmap.new(32, 32)
dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
@cursor_width = dummy_bitmap.text_size("0").width + 8
dummy_bitmap.dispose
super(0, 0, @cursor_width * @digits_max + 32, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = FUKI::MES_FONT_SIZE
self.z += 9999
self.opacity = 0
@index = 0
refresh
update_cursor_rect
end
end
#==============================================================================
# ■ Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ● イベントのセットアップ
# event_id : イベント ID
#--------------------------------------------------------------------------
alias setup_fuki setup
def setup(list, event_id)
setup_fuki(list, event_id)
# 戦闘中でなければ
if !($game_temp.in_battle)
# イベントIDを記録
$active_event_id = event_id
end
end
end