查看: 1449|回复: 4

[已经解决] 关于消息框中更改装备名的颜色

  [复制链接]
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
发表于 2009-7-8 10:21:37 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 幻耶 于 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
囡囚囨囚囨図囨囧
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
 楼主| 发表于 2009-7-9 08:44:58 | 显示全部楼层
顶.........
回复

使用道具 举报

孤独守望

梦石
0
星屑
3144
在线时间
1535 小时
注册时间
2006-10-16
回帖
4223

开拓者贵宾

发表于 2009-7-9 08:57:41 | 显示全部楼层
改成如下的部分。我想设定应该能很容易看懂吧
不过没有全部脚本,没有测试过。
  1. #==============================================================================
  2. # ■获得新防具盾
  3. #==============================================================================
  4. def get_armor1(armor_name, n)
  5.   @armor_name = armor_name
  6.   for i in 1...$data_armors.size
  7.     if $data_armors.name ==  @armor_name
  8.       @armor_id = i
  9.     end
  10.   end
  11.   $game_party.gain_armor(@armor_id, n)
  12.   enghao_showbar_armor = $data_armors[@armor_id]
  13.   enghao_showbar = Window_Base.new((640-300)/2,128,300,100)
  14.   enghao_showbar.contents = Bitmap.new(enghao_showbar.width - 32, enghao_showbar.height - 32)
  15.   if n >= 0
  16.     enghao_showbar.contents.draw_text(0,0,240,32,"获得防具:")
  17.     Audio.se_play("Audio/SE/"+"006-System06",80,100)
  18.   else
  19.     enghao_showbar.contents.draw_text(0,0,240,32,"失去防具:")
  20.     Audio.se_play("Audio/SE/"+"005-System05",80,100)
  21.   end
  22.   enghao_showbar_bitmap = RPG::Cache.icon(enghao_showbar_armor.icon_name)
  23.   enghao_showbar.contents.blt(0, 32, enghao_showbar_bitmap, Rect.new(0, 0, 24, 24), 255)
  24.   #---------------------sign-------------------------
  25.   if enghao_showbar_armor.name[/神话/] != nil
  26.     enghao_showbar.contents.font.color = Color.new(255,215,0)
  27.   end
  28.   #--------------------------------------------------
  29.   enghao_showbar.contents.draw_text(0 + 28, 32, 212, 32, enghao_showbar_armor.name, 0)
  30.   #---------------------sign-------------------------
  31.   enghao_showbar.contents.font.color = normal_color
  32.   #--------------------------------------------------
  33.   enghao_showbar.contents.draw_text(0, 32, 268, 32, "×"+n.abs.to_s, 2)

  34.   enghao_showbar.opacity = 160
  35.   for i in 0...30
  36.     Graphics.update
  37.   end
  38.   for i in 0...10
  39.     enghao_showbar.opacity -= 30
  40.     enghao_showbar.contents_opacity -= 30
  41.     Graphics.update
  42.   end
  43.   enghao_showbar.dispose
  44. end
复制代码
菩提本非树,明镜本非台。回头自望路漫漫。不求姻缘,但求再见。
本来无一物,何处惹尘埃。风打浪吹雨不来。荒庭遍野,扶摇难接。
不知道多久更新一次的博客
回复

使用道具 举报

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
 楼主| 发表于 2009-7-9 09:10:06 | 显示全部楼层
显示出错,normal_color未定义,不过替换成Color.new(255,255,255)应该也可以吧?谢谢了
囡囚囨囚囨図囨囧
回复

使用道具 举报

孤独守望

梦石
0
星屑
3144
在线时间
1535 小时
注册时间
2006-10-16
回帖
4223

开拓者贵宾

发表于 2009-7-9 09:17:42 | 显示全部楼层
啥?不是窗口类?某只在Base里翻了半天默认颜色的默立中
菩提本非树,明镜本非台。回头自望路漫漫。不求姻缘,但求再见。
本来无一物,何处惹尘埃。风打浪吹雨不来。荒庭遍野,扶摇难接。
不知道多久更新一次的博客
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部