#============================================================================== # ■ Window_BattleResult #------------------------------------------------------------------------------ # 战斗结束时、显示获得的 EXP 及金钱的窗口。 #============================================================================== class Window_BattleResult < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # exp : EXP # gold : 金钱 # treasures : 宝物 #-------------------------------------------------------------------------- def initialize(exp, gold, treasures) @exp = exp @gold = gold @treasures = treasures super(160, 0, 320, @treasures.size * 32 + 64) self.contents = Bitmap.new(width - 32, height - 32) y = 0 self.back_opacity = 160 self.visible = false refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, 281, 32, @exp.to_s+" "+"Exp"+" "+@gold.to_s+" "+"Gold",1) y = 32 for item in @treasures draw_item_name(item, 4, y) y += 32 end end end
#==============================================================================
# ■ Window_BattleResult
#------------------------------------------------------------------------------
# 战斗结束时、显示获得的 EXP 及金钱的窗口。
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(160, 0, 320, @treasures.size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
y = 0
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 281, 32, @exp.to_s+" "+"Exp"+" "+@gold.to_s+" "+"Gold",1)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
end
end
咱程度只能把整串用在一行显示了 , 各种长度目前是可以居中了
|