#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :namepop # ポップアップテキスト
#--------------------------------------------------------------------------
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● イベントページの設定をセットアップ
#--------------------------------------------------------------------------
alias tmnpop_game_event_setup_page_settings setup_page_settings
def setup_page_settings
tmnpop_game_event_setup_page_settings
if @list
@namepop = $1 if /<namepop\s*(\S+?)>/i =~ @event.name
@list.each do |list|
if list.code == 108 || list.code == 408
@namepop = $1 if /<namepop\s*(\S+?)>/i =~ list.parameters[0]
else
break
end
end
end
end
end
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias tmnpop_sprite_character_dispose dispose
def dispose
dispose_namepop
tmnpop_sprite_character_dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias tmnpop_sprite_character_update update
def update
tmnpop_sprite_character_update
update_namepop
if @character.namepop != @namepop
@namepop = @character.namepop
start_namepop
end
end
#--------------------------------------------------------------------------
# ○ namepopの開始
#--------------------------------------------------------------------------
def start_namepop
dispose_namepop
return if @namepop == "none" || @namepop == nil
@namepop_sprite = ::Sprite.new(viewport)
h = TMNPOP::FONT_SIZE + 4
@namepop_sprite.bitmap = Bitmap.new(h * 10, h)
@namepop_sprite.bitmap.font.size = TMNPOP::FONT_SIZE
@namepop_sprite.bitmap.font.out_color.alpha = TMNPOP::FONT_OUT_ALPHA
@namepop_sprite.bitmap.draw_text(0, 0, h * 10, h, @namepop, 1)
@namepop_sprite.ox = h * 5
@namepop_sprite.oy = h
update_namepop
end
#--------------------------------------------------------------------------
# ○ namepopの更新
#--------------------------------------------------------------------------
def update_namepop
if @namepop_sprite
@namepop_sprite.x = x
@namepop_sprite.y = y - height
@namepop_sprite.z = z + 200
end
end
#--------------------------------------------------------------------------
# ○ namepopの解放
#--------------------------------------------------------------------------
def dispose_namepop
if @namepop_sprite
@namepop_sprite.bitmap.dispose
@namepop_sprite.dispose
@namepop_sprite = nil
end
end
end作者: taroxd 时间: 2014-8-12 10:24
在事件名或事件第一行注释 <namepop 字符串>