- Victor000.1Membre
- Nombre de messages : 385
Age : 27
Localisation : Picardie
Distinction : Crayon d'Or session n°3
1er membre de la communauté Curse
Date d'inscription : 09/05/2015
Pop / Up Xas
Lun 24 Aoû 2015 - 22:57
Bonsoir,
J'utilise actuellement le Xas et les Pop-Up de combats ne me plaisent guère. Ils gigotent beaucoup. x)
Ils y en a deux types : - Les dommages (portés et reçus) qui sont géré via une image.
- Les gains qui sont affiché directement en script.
En fait j'aimerai savoir comment modifier les paramètres qui gèrent leur trajectoires / Taille / Police / Couleur.
en fait voilà comment elles devraient dans l'idéal apparaître :
dommages : Fondu vertical
Fade IN = 20
Duration = 40
Gains : Fondu horizontal
Fade In = 30
Duration 70
Fade Out = 30
Voici la partie du script qui me semble en cause :
Pour plus d'infos, j'ai trouvé ce script, très personnalisable, je l'ai configuré et voilà à quoi je voudrai que ressemble les Pop-Up du Xas physiquement (Il peut peut être servir de base pour les modifications. ) :
Je vous remercie par avance, et bonne soirée
J'utilise actuellement le Xas et les Pop-Up de combats ne me plaisent guère. Ils gigotent beaucoup. x)
Ils y en a deux types : - Les dommages (portés et reçus) qui sont géré via une image.
- Les gains qui sont affiché directement en script.
En fait j'aimerai savoir comment modifier les paramètres qui gèrent leur trajectoires / Taille / Police / Couleur.
en fait voilà comment elles devraient dans l'idéal apparaître :
dommages : Fondu vertical
Fade IN = 20
Duration = 40
Gains : Fondu horizontal
Fade In = 30
Duration 70
Fade Out = 30
Voici la partie du script qui me semble en cause :
- Code:
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ SPRITE - DAMAGE SPRITE
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ XRXS_DAMAGE_OFFSET
#===============================================================================
module XRXS_DAMAGE_OFFSET
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@damage_sprites = [] if @damage_sprites.nil?
for damage_sprite in @damage_sprites
damage_sprite.x = self.x
damage_sprite.y = self.y
end
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
class Sprite_Character < Sprite_Base
include XRXS_DAMAGE_OFFSET
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
include XAS_DAMAGE_POP
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_damage_pop_initialize initialize
def initialize(viewport = nil)
@_damage_duration = 0
x_damage_pop_initialize(viewport)
end
#--------------------------------------------------------------------------
# ● Damage
#--------------------------------------------------------------------------
def damage(value, type = "")
dispose_damage
@damage_ox = 0
@damage_type = type
# NUMBER PICTURE
if value.is_a?(Numeric)
bitmap_number_image = Cache.system("XAS_Damage_Number")
bitmap_im_cw = bitmap_number_image.width / 10
bitmap_im_ch = bitmap_number_image.height / 5
bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
bitmap_number_text = value.to_s.split(//)
center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
# Damage Color
if value >= 0
if @damage_type == "Critical"
h = bitmap_im_ch * 2
h2 = bitmap_im_ch * 4
$game_map.screen.start_shake(5, 5, 60)
elsif @damage_type == "Mp"
h = bitmap_im_ch * 0
h2 = bitmap_im_ch * 3
else
h = 0
end
f = 0
else # Recover Color
h = bitmap_im_ch
h2 = bitmap_im_ch * 3 if @damage_type == "Mp"
f = 1
end
for r in f..bitmap_number_text.size - 1
bitmap_number_abs = bitmap_number_text[r].to_i
bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
bitmap.blt(center_x + (bitmap_im_cw * r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)
end
ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
@damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
# Add Extra String (MP / Critical)
if h2 != nil
string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
bitmap_src_rect = Rect.new(0, h2, bitmap_number_image.width, bitmap_im_ch)
bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)
end
bitmap_number_image.dispose
else
#TEXT STRING
damage_string = value.to_s
bitmap = Bitmap.new(180, 48)
bitmap.font.name = DAMAGE_FONT_NAME
bitmap.font.size = DAMAGE_FONT_SIZE
bitmap.font.bold = DAMAGE_FONT_BOLD
bitmap.font.color = Color.new(0,0,0)
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
case @damage_type
when "Exp"; string_color = DAMAGE_EXP_FONT_COLOR
when "Gold"; string_color = DAMAGE_GOLD_FONT_COLOR
when "Item"; string_color = DAMAGE_ITEM_FONT_COLOR
else
string_color = DAMAGE_DEFAULT_FONT_COLOR
end
bitmap.font.color = string_color
bitmap.draw_text(0,12, 160, 36, damage_string, 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x + @damage_ox
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 60
end
#--------------------------------------------------------------------------
# ● Dispose Damage
#--------------------------------------------------------------------------
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.bitmap.dispose
@_damage_sprite.dispose
@_damage_sprite = nil
@_damage_duration = 0
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias x_damage_dispose dispose
def dispose
dispose_damage
x_damage_dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias x_damage_pop_update update
def update
if @_damage_duration > 0
@_damage_duration -= 1
if @_damage_duration == 0
dispose_damage
end
end
x_damage_pop_update
end
end
#===============================================================================
# ■ XRXS DAMAGE
#===============================================================================
module XRXS_DAMAGE
#--------------------------------------------------------------------------
# ● Damage X Init Velocity
#--------------------------------------------------------------------------
def damage_x_init_velocity
return 0.2 * (rand(3) - 2)
end
#--------------------------------------------------------------------------
# ● Damage Y Init Velocity
#--------------------------------------------------------------------------
def damage_y_init_velocity
return 9
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@damage_sprites = [] if @damage_sprites.nil?
@damage_durations = [] if @damage_durations.nil?
if @_damage_sprite != nil and @_damage_sprite.visible
if @damage_ox != nil
dam_ox = @damage_ox
else
dam_ox = 0
end
if @damage_type != nil
dam_type = @damage_type
end
x = damage_x_init_velocity
y = damage_y_init_velocity
d = @_damage_duration
@damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
@_damage_sprite.visible = false
end
for damage_sprite in @damage_sprites
damage_sprite.update
end
for i in 0...@damage_sprites.size
@damage_sprites[i] = nil if @damage_sprites[i].disposed?
end
@damage_sprites.compact!
end
def dispose
super
if @damage_sprites != nil
for damage_sprite in @damage_sprites
damage_sprite.dispose
end
end
end
end
#===============================================================================
# ■ RPG Sprite
#===============================================================================
class Sprite_Base < Sprite
include XRXS_DAMAGE
end
#===============================================================================
# ■ Sprite Damage
#===============================================================================
class Sprite_Damage < Sprite
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
super(nil)
self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
self.opacity = sprite.opacity
self.x = sprite.x
self.y = sprite.y
self.z = sprite.z
self.ox = sprite.ox - dam_ox
self.oy = sprite.oy
@now_x_speed = init_x_speed
@now_y_speed = init_y_speed
@potential_x_energy = 0.0
@potential_y_energy = 0.0
@duration = duration
@dam_type = dam_type
@dam_type = "" if dam_type == nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
if @dam_type != "Critical"
update_normal_popup
else
update_critical_effect
end
else
update_normal_popup
end
@duration -= 1
if @duration == 0
self.dispose
end
end
#--------------------------------------------------------------------------
# ● update_critical_effect
#--------------------------------------------------------------------------
def update_critical_effect
case @duration
when 40..60
self.zoom_x += 0.1
self.zoom_y += 0.1
else
if self.zoom_x > 0.1
self.zoom_x -= 0.1
self.zoom_y -= 0.1
end
end
end
#--------------------------------------------------------------------------
# ● update_normal_popup
#--------------------------------------------------------------------------
def update_normal_popup
self.opacity -= 25 if @duration <= 10
n = self.oy + @now_y_speed
if n <= 0
@now_y_speed *= -1
@now_y_speed /= 2
@now_x_speed /= 2
end
self.oy = [n, 0].max
@potential_y_energy += 0.58
speed = @potential_y_energy.floor
@now_y_speed -= speed
@potential_y_energy -= speed
@potential_x_energy += @now_x_speed
speed = @potential_x_energy.floor
self.ox += speed
@potential_x_energy -= speed
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ SPRITE - SPRITE EFFECTS
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Animation Set Sprite
#--------------------------------------------------------------------------
def animation_set_sprites(frame)
cell_data = frame.cell_data
@ani_sprites.each_with_index do |sprite, i|
next unless sprite
pattern = cell_data[i, 0]
if !pattern || pattern < 0
sprite.visible = false
next
end
sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
if @ani_mirror
cx = cell_data[i, 1]
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
cx = cell_data[i, 1]
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
cy = cell_data[i, 2]
sprite.z = self.z + 300 + i
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
case @animation.position
when 0
sprite.x = self.x + cx
sprite.y = self.y + cy - (height / 2)
when 1
sprite.x = self.x + cx
sprite.y = self.y + cy
when 2
sprite.x = self.x + cx
sprite.y = self.y + cy + (height / 2)
when 3
sprite.x = (544 / 2) + cx
sprite.y = (416 / 2) + cy
end
end
end
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
def dispose_animation
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil
@animation = nil
end
@ani_bitmap1 = nil
@ani_bitmap2 = nil
end
end
#==============================================================================
# ■ Scene_Base
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias animation_garbage_setup setup
def setup(map_id)
animation_garbage_setup(map_id)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Scene_Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Scene Changing?
#--------------------------------------------------------------------------
alias animation_garbage_scene_changing scene_changing?
def scene_changing?
$game_map.dispose_animation_garbage if SceneManager.scene != self
animation_garbage_scene_changing
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
class Sprite_Character < Sprite_Base
include XAS_SYSTEM
#--------------------------------------------------------------------------
# ● Setup New Effect
#--------------------------------------------------------------------------
def setup_new_effect
if @character.animation_id > 0
animation = $data_animations[@character.animation_id]
start_animation(animation)
@character.animation_id = 0
end
if !@balloon_sprite && @character.balloon_id > 0
@balloon_id = @character.balloon_id
start_balloon
end
end
#--------------------------------------------------------------------------
# ● Can Update X Effects
#--------------------------------------------------------------------------
def can_update_x_effects?
return false unless CHARACTER_SPRITE_EFFECTS
return false if @character.erased
return false if @character.transparent == true
return true
end
#--------------------------------------------------------------------------
# ● Can Damage Pop Base
#--------------------------------------------------------------------------
def can_damage_pop_base?
return false unless $game_system.xas_battle
return false if XAS_SYSTEM::DAMAGE_POP == false
return false if @character.battler == nil
return false if @character.battler.no_damage_pop
return false if @character.battler.damage_pop != true
return true
end
#--------------------------------------------------------------------------
# ● Execute Damage Pop
#--------------------------------------------------------------------------
def execute_damage_pop
damage(@character.battler.damage, @character.battler.damage_type)
@character.battler.damage = nil
@character.battler.critical = false
@character.battler.damage_pop = false
@character.battler.damage_type = ""
end
#--------------------------------------------------------------------------
# ● Update X Effects
#--------------------------------------------------------------------------
def update_x_effects
update_collaspse_effects if @character.collapse_duration > 0
update_sprite_position
update_angle
update_zoom
end
#--------------------------------------------------------------------------
# ● Update Angle
#--------------------------------------------------------------------------
def update_angle
return if @character.angle == self.angle
self.angle = @character.angle
end
#--------------------------------------------------------------------------
# ● Update Zoom
#--------------------------------------------------------------------------
def update_zoom
update_treasure_effect
update_breath_effect if can_breath_effect?
self.zoom_x = @character.zoom_x
self.zoom_y = @character.zoom_y
end
#--------------------------------------------------------------------------
# ● Update Treasure_effect
#--------------------------------------------------------------------------
def update_treasure_effect
return if @character.treasure_time == 0
update_treasure_fade_effect
update_treasure_float_effect
end
#--------------------------------------------------------------------------
# ● update_treasure_fade_effect
#--------------------------------------------------------------------------
def update_treasure_fade_effect
return unless XAS_BA::FADE_TREASURE_SPRITE
return if @character.treasure_time > 100
return if @character.zoom_x < 0.01
@character.zoom_x -= 0.01
if @character.temp_id > 0
@character.zoom_x = 1.00
@character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
end
end
#--------------------------------------------------------------------------
# ● Update Treasure Float Effect
#--------------------------------------------------------------------------
def update_treasure_float_effect
return unless XAS_BA::FLOAT_TREASURE_SPRITE
return if self.character.jumping?
self.character.treasure_float[2] += 1
if self.character.treasure_float[2] > 1
self.character.treasure_float[2] = 0
self.character.treasure_float[1] += 1
case self.character.treasure_float[1]
when 1..15
self.character.treasure_float[0] -= 1
when 16..30
self.character.treasure_float[0] += 1
else
self.character.treasure_float[0] = 0
self.character.treasure_float[1] = 0
end
end
self.y += self.character.treasure_float[0]
end
#--------------------------------------------------------------------------
# ● Can Breath Effect?
#--------------------------------------------------------------------------
def can_breath_effect?
return false if @character.battler == nil
return false if @character.battler.breath_effect == false
return false if @character.battler.hp == 0
return false if @character.stop and not @character.battler.state_sleep
return true
end
#--------------------------------------------------------------------------
# ● Update Breath Effect
#--------------------------------------------------------------------------
def update_breath_effect
if @character.battler.fast_breath_effect
zoom_speed = 3
zoom_power_x = 0.006
zoom_power_y = 0.006
else
zoom_speed = 1
zoom_power_x = 0
zoom_power_y = 0.002
end
@character.battler.breath_duration += zoom_speed
case @character.battler.breath_duration
when 1..30
@character.zoom_x += zoom_power_x
@character.zoom_y += zoom_power_y
when 31..60
@character.zoom_x -= zoom_power_x
@character.zoom_y -= zoom_power_y
else
@character.battler.breath_duration = 0
@character.zoom_x = 1.00
@character.zoom_y = 1.00
end
end
#--------------------------------------------------------------------------
# ● Update Sprite Position
#--------------------------------------------------------------------------
alias x_set_character_bitmap set_character_bitmap
def set_character_bitmap
@py = nil
x_set_character_bitmap
if @character_name[/\((\d+)\)/]
@py = $1.to_i
end
end
#--------------------------------------------------------------------------
# ● Update Sprite Position
#--------------------------------------------------------------------------
def update_sprite_position
if @character.tool_id > 0
if @character.tool_effect == "Barrier"
unless @character.action == nil
bullet_user = @character.action.user
self.x = bullet_user.screen_x
self.y = bullet_user.screen_y
@character.x = bullet_user.x
@character.y = bullet_user.y
@character.direction = bullet_user.direction
end
end
end
update_hold_target
if @py != nil
self.y += @py
end
if @character.angle == 315 and @cw != nil
self.x -= (@cw / 3)
self.y -= (@ch / 6)
end
if XAS_BA::KNOCKBACKING_SHAKE
if self.character.knockbacking?
self.x = self.x + rand(5) unless self.character.dead?
end
end
end
#--------------------------------------------------------------------------
# ● Update X Effects
#--------------------------------------------------------------------------
def update_hold_target
return if @character.temp_id == 0
target = $game_map.events[@character.temp_id]
if target == nil or target.erased
@character.temp_id = 0
@character.move_speed = @character.pre_move_speed
check_character_above_player(target)
else
self.x = target.screen_x
self.y = target.screen_y
self.character.x = target.x
self.character.y = target.y
self.character.move_speed = target.move_speed
self.character.direction = target.direction unless self.character.direction_fix
check_character_above_player(target)
end
end
#--------------------------------------------------------------------------
# ● Check Chacracter Above Player
#--------------------------------------------------------------------------
def check_character_above_player(target)
return if @character.is_a?(Game_Player)
return if @character.battler == nil
if (@character.x == $game_player.x and
@character.y == $game_player.y) or
not @character.passable_temp_id?(@character.x,@character.y)
@character.temp_id = 0
@character.move_speed = @character.pre_move_speed
case @character.direction
when 2; @character.y -= 1
when 4; @character.x += 1
when 6; @character.x -= 1
when 8; @character.y += 1
end
end
end
#--------------------------------------------------------------------------
# ● Update_balloon
#--------------------------------------------------------------------------
if XAS_BA::FIX_BALLOON_POSITION
def update_balloon
if @balloon_duration > 0
@balloon_duration -= 1
if @balloon_duration > 0
@balloon_sprite.x = x
@balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
@balloon_sprite.z = z + 200
sx = balloon_frame_index * 32
sy = (@balloon_id - 1) * 32
@balloon_sprite.src_rect.set(sx, sy, 32, 32)
else
end_balloon
end
end
end
end
end
Pour plus d'infos, j'ai trouvé ce script, très personnalisable, je l'ai configuré et voilà à quoi je voudrai que ressemble les Pop-Up du Xas physiquement (Il peut peut être servir de base pour les modifications. ) :
- Code:
#Sleek Item Popup v1.10
#----------#
#Features: A nice and sleek little pop up you can use to tell the player
# they received (or lost) an item! Now with automatic popups whenever
# you use the gain item commands in events!
#
#Usage: Event Script Call:
# popup(type,item,amount,[duration],[xoff],[yoff])
#
# Where: type is category of item (0 = item, 1 = weapon,
# 2 = armor, 3 = gold)
# item is the id number of the item
# amount is the amount lost or gained
# duration is the time the window is up and is optional
#
# Examples:
# popup(0,1,5)
# popup(2,12,1,120)
# $PU_AUTOMATIC_POPUP = false
# $PU_AUTOMATIC_POPUP = true
#
#Customization: Everything down there under customization
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
# posted on the thread for the script
# given by email: sumptuaryspade@live.ca
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
# posed on site: daimonioustails.wordpress.com
#
#--- Free to use in any non-commercial project with credit given
#-- License required for commercial project use
#Sound effect played on popup: # "Filename", Volume(0-100), Pitch(50-150)
PU_SOUND_EFFECT = ["Item1",80,50]
#Animation to be played on the player during popup
PU_USE_ANIMATION = false
PU_POPUP_ANIMATION = 2
#Duration in frames of Item Popup fadein and fadeout
PU_FADEIN_TIME = 30
PU_FADEOUT_TIME = 30
#Default duration of the popup
PU_DEFAULT_DURATION = 70
#Use automatic popup? Can be enabled/disabled in game, see examples
$PU_AUTOMATIC_POPUP = true
#Whether to use a custom or default font
PU_USE_CUSTOM_FONT = false
#Settings for custom item popup font
PU_DEFAULT_FONT_NAME = ["Verdana"]
PU_DEFAULT_FONT_SIZE = 16
PU_DEFAULT_FONT_COLOR = Color.new(255,255,255,255)
PU_DEFAULT_FONT_BOLD = false
PU_DEFAULT_FONT_ITALIC = false
PU_DEFAULT_FONT_SHADOW = false
PU_DEFAULT_FONT_OUTLINE = true
#Compact mode will hide the amount unless it's greater then 1
PU_COMPACT_MODE = true
#Background Icon to be displayed under item icon
PU_USE_BACKGROUND_ICON = false
PU_BACKGROUND_ICON = 102
#Gold details:
PU_GOLD_NAME = "Âme F."
PU_GOLD_ICON = 23
#True for single line, false for multi line
PU_SINGLE_LINE = true
class Item_Popup < Window_Base
def initialize(item, amount, duration, nosound,xoff,yoff)
super(0,0,100,96)
Audio.se_play('Audio/SE/' + PU_SOUND_EFFECT[0],PU_SOUND_EFFECT[1],PU_SOUND_EFFECT[2]) unless PU_SOUND_EFFECT.nil? or nosound
self.opacity = 0
self.x = $game_player.screen_x - 16
self.y = $game_player.screen_y - 80
@xoff = 0
@yoff = 0
@duration = 90
@item = item
@amount = amount
@name = item.name.clone
@text = ""
@timer = 0
@split = (PU_FADEIN_TIME) / @name.size
@split = 2 if @split < 2
amount > 0 ? @red = false : @red = true
if PU_USE_CUSTOM_FONT
contents.font.size = PU_DEFAULT_FONT_SIZE
else
contents.font.size = 16
end
@textsize = text_size(@name)
textsize2 = text_size("+" + amount.to_s)
self.width = @textsize.width + 54
self.width += textsize2.width + 48 if PU_SINGLE_LINE
self.height = @textsize.height + 54
self.height -= 24 if PU_SINGLE_LINE
self.x -= self.width / 4
create_contents
if PU_USE_CUSTOM_FONT
contents.font.name = PU_DEFAULT_FONT_NAME
contents.font.size = PU_DEFAULT_FONT_SIZE
contents.font.color = PU_DEFAULT_FONT_COLOR
contents.font.bold = PU_DEFAULT_FONT_BOLD
contents.font.italic = PU_DEFAULT_FONT_ITALIC
contents.font.shadow = PU_DEFAULT_FONT_SHADOW
contents.font.outline = PU_DEFAULT_FONT_OUTLINE
end
self.contents_opacity = 0
$game_player.animation_id = PU_POPUP_ANIMATION if PU_USE_ANIMATION
update
end
def update
#super
return if self.disposed?
self.visible = true if !self.visible
self.x = $game_player.screen_x - 16 + @xoff
self.y = $game_player.screen_y - 80 + @yoff
self.x -= self.width / 4
open if @timer < (PU_FADEIN_TIME)
close if @timer > (PU_FADEOUT_TIME + @duration)
@timer += 1
@text += @name.slice!(0,1) if @timer % @split == 0
contents.clear
@red ? color = Color.new(255,0,0) : color = Color.new(0,255,0)
contents.font.color = color
stringamount = @amount
stringamount = "+" + @amount.to_s if @amount > 0
if PU_SINGLE_LINE
width = text_size(@item.name).width#@textsize.width
draw_text(27 + width,0,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
contents.font.color = Font.default_color
draw_text(24,0,contents.width,contents.height,@text)
draw_icon(PU_BACKGROUND_ICON,0,0) if PU_USE_BACKGROUND_ICON
draw_icon(@item.icon_index,0,0)
else
draw_text(contents.width / 4 + 16,24,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
contents.font.color = Font.default_color
draw_icon(PU_BACKGROUND_ICON,contents.width / 4 - 12,24) if PU_USE_BACKGROUND_ICON
draw_icon(@item.icon_index,contents.width / 4 - 12,24)
draw_text(0,0,contents.width,contents.height,@text)
end
end
def close
self.contents_opacity -= (255 / (PU_FADEOUT_TIME))
end
def open
self.contents_opacity += (255 / (PU_FADEIN_TIME))
end
end
class Game_Interpreter
alias pu_command_126 command_126
alias pu_command_127 command_127
alias pu_command_128 command_128
alias pu_command_125 command_125
def popup(type,item,amount,duration = PU_DEFAULT_DURATION,nosound = false, xo = 0, yo = 0)
data = $data_items[item] if type == 0
data = $data_weapons[item] if type == 1
data = $data_armors[item] if type == 2
if type == 3
data = RPG::Item.new
data.name = PU_GOLD_NAME
data.icon_index = PU_GOLD_ICON
end
Popup_Manager.add(data,amount,duration,nosound,xo,yo)
end
def command_126
pu_command_126
value = operate_value(@params[1], @params[2], @params[3])
popup(0,@params[0],value) if $PU_AUTOMATIC_POPUP
end
def command_127
pu_command_127
value = operate_value(@params[1], @params[2], @params[3])
popup(1,@params[0],value) if $PU_AUTOMATIC_POPUP
end
def command_128
pu_command_128
value = operate_value(@params[1], @params[2], @params[3])
popup(2,@params[0],value) if $PU_AUTOMATIC_POPUP
end
def command_125
pu_command_125
value = operate_value(@params[0], @params[1], @params[2])
popup(3,@params[0],value) if $PU_AUTOMATIC_POPUP
end
end
module Popup_Manager
def self.init
@queue = []
end
def self.add(item,value,dura,ns,xo,yo)
@queue.insert(0,[item,value,dura,ns,xo,yo])
end
def self.queue
@queue
end
end
Popup_Manager.init
class Scene_Map
alias popup_update update
alias popup_preterminate pre_terminate
def update
popup_update
update_popup_window unless $popupwindow.nil?
return if Popup_Manager.queue.empty?
if $popupwindow.nil? or $popupwindow.contents_opacity == 0
var = Popup_Manager.queue.pop
$popupwindow = Item_Popup.new(var[0],var[1],var[2],var[3],var[4],var[5])
end
end
def update_popup_window
$popupwindow.update
if !$popupwindow.disposed? and $popupwindow.contents_opacity == 0
$popupwindow.dispose
$popupwindow = nil
end
end
def pre_terminate
popup_preterminate
$popupwindow.visible = false unless $popupwindow.nil?
end
end
Je vous remercie par avance, et bonne soirée
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|