赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1515 |
最后登录 | 2013-6-20 |
在线时间 | 48 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 48 小时
- 注册时间
- 2006-12-10
- 帖子
- 51
|
5楼
楼主 |
发表于 2013-4-23 09:30:46
|
只看该作者
#==============================================================================
# ■ Sprite_BasicWindow
#==============================================================================
class Sprite_BasicWindow < Sprite_Window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x = $game_variables[22], y = $game_variables[23])
super(x, y, MMO_BASIC)
self.visible = ($game_variables[21] == 1)
self.z = 180
@bitmap = Cache.system("基本信息")
self.bitmap = Bitmap.new(@bitmap.width, @bitmap.height)
@title_height = self.height # ウィンドウ全体をタイトルバー扱いにする
refresh
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update(mouse_x, mouse_y, obj)
return unless self.visible # 非表示なら終了
super(mouse_x, mouse_y, obj)
refresh if $game_temp.basewin_refresh # フラグが立っていれば再描画
end
#--------------------------------------------------------------------------
# ● 再描画
#--------------------------------------------------------------------------
def refresh
actor = $game_party.members[0]
self.bitmap.clear
self.bitmap.blt(0, 0, @bitmap, Rect.new(0, 0, self.width, self.height))
self.bitmap.font.size = 13
text = sprintf("%s", actor.name)
self.bitmap.draw_text(110, 18, 65, 18, text,1)
text = sprintf("%d", $game_party.gold)
nil while text.gsub!(/(.*\d)(\d\d\d)/, '\1,\2')
self.bitmap.draw_text(110, 36, 63, 16, text, 1)
text = sprintf("等级%d",actor.blevel)
self.bitmap.draw_text(18, 18, 54, 18, text,1)
text = sprintf("经验 %d%%", actor.bexp_rate)
self.bitmap.draw_text(18, 35, 60, 18, text,1)
text = sprintf("体力")
self.bitmap.draw_text(75, 1, 544, 18, text)
text = sprintf("%d/%d", actor.hp,actor.maxhp)
self.bitmap.draw_text(78, 1, 98, 18, text,1)
text = sprintf("魔法")
self.bitmap.draw_text(18, 1, 544, 18, text)
text = sprintf("%d/%d",actor.mp, actor.maxmp)
self.bitmap.draw_text(18, 1, 98, 18, text,1)
$game_temp.basewin_refresh = false # 再描画フラグを倒す
end
#--------------------------------------------------------------------------
# ● ウィンドウ位置の保存
#--------------------------------------------------------------------------
def save_pos
$game_variables[21] = self.visible ? 1 : 0
$game_variables[22] = self.x
$game_variables[23] = self.y
end
end |
|