#==============================================================================
# ■ Sprite_Timer
#------------------------------------------------------------------------------
# 显示计时器用的活动块。监视 $game_system 、活动块状态
# 自动变化。
#==============================================================================
class Sprite_Timer < Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super
self.bitmap = Bitmap.new(88, 80)
self.bitmap.font.name = "宋体"#"Arial"
self.bitmap.font.size = 14
self.x = 640 - self.bitmap.width + 14
self.y = 50 + 3
self.z = 500
# 战斗计时系统★★★★★★★★★★★★★★★★★★★★★★★★★
if $game_temp.in_battle
self.bitmap.font.size = 80
self.x = 260
self.y = 10
self.z = 500
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 设置计时器执行中为可见
self.visible = $game_system.timer_working
# 如果有必要再次描绘计时器
if $game_system.timer / Graphics.frame_rate != @total_sec
# 清除窗口内容
self.bitmap.clear
# 计算总计秒数
@total_sec = $game_system.timer / Graphics.frame_rate
# 生成计时器显示用字符串
min = @total_sec / 60
sec = @total_sec % 60
text = sprintf("%02d:%02d", min, sec)
if $game_temp.in_battle
text = sprintf("%02d", sec)
end
# 描绘计时器
self.bitmap.font.color.set(255, 255, 255)
if $game_switches[68]
self.bitmap.font.color.set(255, 228, 0)
@syx_icon = RPG::Cache.icon("摄妖香-图标")
self.bitmap.blt(32, 0, @syx_icon, Rect.new(0, 0, 22, 22))
self.bitmap.draw_text(0, 25, 88, 15, text, 1)#(self.bitmap.rect, text, 1)
end
if $game_temp.in_battle
if sec >= 0
self.bitmap.font.color.set(255, 0, 0)
self.bitmap.draw_text(self.bitmap.rect, text, 1)
else
self.bitmap.font.color.set(255, 0, 0)
self.bitmap.draw_text(self.bitmap.rect, text, 1)
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
end
end
end