Project1
标题:
关于消息框中更改装备名的颜色
[打印本页]
作者:
幻耶
时间:
2009-7-8 10:21
标题:
关于消息框中更改装备名的颜色
本帖最后由 幻耶 于 2009-7-9 08:44 编辑
用了enghao_Lim的打造随机装备脚本,那脚本的末尾有获得新装备的提示框,能否在提示框中就显示不同颜色的字体?
比如:如果获得的新防具名称中包含有”神话“两个字的,提示框里的字就是金色的:Color.new(255,215,0)
获得新防具的提示框脚本部分
#==============================================================================
# ■获得新防具盾
#==============================================================================
def get_armor1(armor_name, n)
@armor_name = armor_name
for i in 1...$data_armors.size
if $data_armors
.name == @armor_name
@armor_id = i
end
end
$game_party.gain_armor(@armor_id, n)
enghao_showbar_armor = $data_armors[@armor_id]
enghao_showbar = Window_Base.new((640-300)/2,128,300,100)
enghao_showbar.contents = Bitmap.new(enghao_showbar.width - 32, enghao_showbar.height - 32)
if n >= 0
enghao_showbar.contents.draw_text(0,0,240,32,"获得防具:")
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
enghao_showbar.contents.draw_text(0,0,240,32,"失去防具:")
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
enghao_showbar_bitmap = RPG::Cache.icon(enghao_showbar_armor.icon_name)
enghao_showbar.contents.blt(0, 32, enghao_showbar_bitmap, Rect.new(0, 0, 24, 24), 255)
enghao_showbar.contents.draw_text(0 + 28, 32, 212, 32, enghao_showbar_armor.name, 0)
enghao_showbar.contents.draw_text(0, 32, 268, 32, "×"+n.abs.to_s, 2)
enghao_showbar.opacity = 160
for i in 0...30
Graphics.update
end
for i in 0...10
enghao_showbar.opacity -= 30
enghao_showbar.contents_opacity -= 30
Graphics.update
end
enghao_showbar.dispose
end
作者:
幻耶
时间:
2009-7-9 08:44
顶.........
作者:
IamI
时间:
2009-7-9 08:57
改成如下的部分。我想设定应该能很容易看懂吧
不过没有全部脚本,没有测试过。
#==============================================================================
# ■获得新防具盾
#==============================================================================
def get_armor1(armor_name, n)
@armor_name = armor_name
for i in 1...$data_armors.size
if $data_armors.name == @armor_name
@armor_id = i
end
end
$game_party.gain_armor(@armor_id, n)
enghao_showbar_armor = $data_armors[@armor_id]
enghao_showbar = Window_Base.new((640-300)/2,128,300,100)
enghao_showbar.contents = Bitmap.new(enghao_showbar.width - 32, enghao_showbar.height - 32)
if n >= 0
enghao_showbar.contents.draw_text(0,0,240,32,"获得防具:")
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
enghao_showbar.contents.draw_text(0,0,240,32,"失去防具:")
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
enghao_showbar_bitmap = RPG::Cache.icon(enghao_showbar_armor.icon_name)
enghao_showbar.contents.blt(0, 32, enghao_showbar_bitmap, Rect.new(0, 0, 24, 24), 255)
#---------------------sign-------------------------
if enghao_showbar_armor.name[/神话/] != nil
enghao_showbar.contents.font.color = Color.new(255,215,0)
end
#--------------------------------------------------
enghao_showbar.contents.draw_text(0 + 28, 32, 212, 32, enghao_showbar_armor.name, 0)
#---------------------sign-------------------------
enghao_showbar.contents.font.color = normal_color
#--------------------------------------------------
enghao_showbar.contents.draw_text(0, 32, 268, 32, "×"+n.abs.to_s, 2)
enghao_showbar.opacity = 160
for i in 0...30
Graphics.update
end
for i in 0...10
enghao_showbar.opacity -= 30
enghao_showbar.contents_opacity -= 30
Graphics.update
end
enghao_showbar.dispose
end
复制代码
作者:
幻耶
时间:
2009-7-9 09:10
显示出错,normal_color未定义,不过替换成Color.new(255,255,255)应该也可以吧?谢谢了
作者:
IamI
时间:
2009-7-9 09:17
啥?不是窗口类?某只在Base里翻了半天默认颜色的默立中
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1