class Scene_Map
@@gainitem_sprite = []
alias mf240903start start
def start
mf240903start
$show_gain_items ||= []
end
alias mf240903update update
def update
mf240903update
update_show_gain_items
update_gainitem_sprite
end
def update_show_gain_items
return unless $show_gain_items && $show_gain_items != []
draw_gainitem_sprite
end
def draw_gainitem_sprite
sprite = Sprite.new
sprite.bitmap = Bitmap.new(150,24)
sprite.x = 544+150
sprite.y = 200
c1 = Color.new(0,0,0,128)
c2 = Color.new(0,0,0,255)
sprite.bitmap.gradient_fill_rect(0,0,150,24,c1,c2)
draw_gainitem_text(sprite)
end
def draw_gainitem_text(sprite)
item = $show_gain_items.shift
item_name = item[0]
item_icon = item[1]
bitmap = Cache.system("Iconset")
rect = Rect.new(item_icon % 16 * 24, item_icon / 16 * 24, 24, 24)
sprite.bitmap.blt(50,0,bitmap,rect)
sprite.bitmap.font.size = 16
sprite.bitmap.draw_text(0,0,150,24,"获得了")
sprite.bitmap.font.color = Color.new(255,215,0)
sprite.bitmap.draw_text(0,0,150,24,item_name,2)
sprite.bitmap.font.size = 24
sprite.bitmap.font.color = Color.new(255,255,255)
sprite.x += @@gainitem_sprite.size * 30
sprite.y += @@gainitem_sprite.size * 24
@@gainitem_sprite << [sprite,90]
end
def move_gainitem_sprite(sprite)
return if sprite.x <= 544-150
sprite.x -= 3
end
def update_gainitem_sprite
return unless @@gainitem_sprite && @@gainitem_sprite != []
@@gainitem_sprite.each do |s|
move_gainitem_sprite(s[0])
s[1] -= 1 if s[0].x <= 544-150
if s[1] <= 0
s[0].opacity -= 10
s[0].dispose if s[0].opacity <= 0
end
end
@@gainitem_sprite.each {|s| @@gainitem_sprite.delete(s) if s[0].disposed?}
end
end
class Game_Party
alias mf240903gain_item gain_item
def gain_item(item, amount, include_equip = false)
mf240903gain_item(item, amount, include_equip = false)
$show_gain_items << [item.name,item.icon_index] if item && amount > 0
end
alias mf240903gain_gold gain_gold
def gain_gold(amount)
mf240903gain_gold(amount)
$show_gain_items << [amount.to_s,262] if amount > 0
end
end