设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3700|回复: 2
打印 上一主题 下一主题

[RMVA发布] 【狂晓霸道】装备品质1.0(物品颜色描绘)

[复制链接]

Lv2.观梦者

梦石
0
星屑
375
在线时间
602 小时
注册时间
2014-5-8
帖子
699
跳转到指定楼层
1
发表于 2016-11-10 14:44:00 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 布罗利 于 2016-11-10 14:49 编辑

首先附上本来的物品颜色描绘:https://rpg.blue/thread-217113-1-1.html
感觉这个描绘的太朴素了,于是自己写了个华丽点的(个人认为而已)
先附上所需素材(素材放到Graphics/System里):
然后再附上范例: 装备品质.zip (1.44 MB, 下载次数: 811)
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 装备品质1.0   By 狂晓霸道丶 QQ1711044261  2016/11/10
  3. #------------------------------------------------------------------------------
  4. # ★ 使用说明
  5. #  - 在物品/武器/护甲的注释处,写入:品质[颜色]  例如:品质[橙]
  6. #  - 颜色分别有:白、绿、蓝、紫、橙、红
  7. #  - 素材放在(Graphics/System)的文件夹里,名字为:品质颜色 
  8. #==============================================================================
  9. class RPG::BaseItem
  10.   attr_accessor :quality
  11.   def quality
  12.     a = ["白","绿","蓝","紫","橙","红"]
  13.     note =~ /品质\[(.+?)\]/
  14.     return a.index($1) if $1 != nil
  15.     return 0 if [url=home.php?mod=space&uid=29701]@Quality[/url] == nil
  16.     @quality
  17.   end
  18. end
  19. #==============================================================================
  20. # ■ Window_Base
  21. #------------------------------------------------------------------------------
  22. #  游戏中所有窗口的父类
  23. #==============================================================================
  24. class Window_Base
  25.   #--------------------------------------------------------------------------
  26.   # ● 绘制物品名称
  27.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  28.   #--------------------------------------------------------------------------
  29.   def draw_item_name(item, x, y, enabled = true, width = 172)
  30.     return unless item
  31.     bitmap = Cache.system("品质颜色")
  32.     rect = Rect.new(32*item.quality,0, 32, 32)
  33.     contents.blt(x, y, bitmap, rect)
  34.     draw_icon(item.icon_index, x+4, y+4)
  35.     change_color(normal_color, enabled)
  36.     draw_text(x + 24+10, y+4, width, line_height, item.name)
  37.   end
  38. end
  39. #==============================================================================
  40. # ■ Window_ItemList
  41. #------------------------------------------------------------------------------
  42. #  物品画面中,显示持有物品的窗口。
  43. #==============================================================================
  44. class Window_ItemList
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取项目的高度
  47.   #--------------------------------------------------------------------------
  48.   def item_height
  49.     line_height + 12
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 绘制项目
  53.   #--------------------------------------------------------------------------
  54.   def draw_item(index)
  55.     item = @data[index]
  56.     if item
  57.       rect = item_rect(index)
  58.       rect.width -= 4
  59.       draw_item_name(item, rect.x+2, rect.y+2, enable?(item))
  60.       draw_item_number(rect, item)
  61.     end
  62.   end
  63. end
  64. #==============================================================================
  65. # ■ Window_ShopBuy
  66. #------------------------------------------------------------------------------
  67. #  商店画面中,买入时显示所有商品的窗口。
  68. #==============================================================================
  69. class Window_ShopBuy
  70.   #--------------------------------------------------------------------------
  71.   # ● 获取项目的高度
  72.   #--------------------------------------------------------------------------
  73.   def item_height
  74.     line_height + 12
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 绘制项目
  78.   #--------------------------------------------------------------------------
  79.   def draw_item(index)
  80.     item = @data[index]
  81.     rect = item_rect(index)
  82.     draw_item_name(item, rect.x+2, rect.y+2, enable?(item))
  83.     rect.width -= 4
  84.     draw_text(rect, price(item), 2)
  85.   end
  86. end
  87. #==============================================================================
  88. # ■ Window_EquipSlot
  89. #------------------------------------------------------------------------------
  90. #  装备画面中,显示角色当前装备的窗口。
  91. #==============================================================================
  92. class Window_EquipSlot
  93.   #--------------------------------------------------------------------------
  94.   # ● 获取项目的高度
  95.   #--------------------------------------------------------------------------
  96.   def item_height
  97.     line_height + 12
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 绘制项目
  101.   #--------------------------------------------------------------------------
  102.   def draw_item(index)
  103.     return unless @actor
  104.     rect = item_rect(index)
  105.     change_color(system_color, enable?(index))
  106.     draw_text(rect.x+2, rect.y+6, 92, line_height, slot_name(index))
  107.     draw_item_name(@actor.equips[index], rect.x + 92+2, rect.y+2, enable?(index))
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 刷新
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     create_contents
  114.     draw_all_items
  115.   end
  116. end
  117. #==============================================================================
  118. # ■ Window_Status
  119. #------------------------------------------------------------------------------
  120. #  状态画面中,显示角色基本信息的窗口。
  121. #==============================================================================
  122. class Window_Status
  123.   #--------------------------------------------------------------------------
  124.   # ● 绘制装备
  125.   #--------------------------------------------------------------------------
  126.   def draw_equipments(x, y)
  127.     @actor.equips.each_with_index do |item, i|
  128.       draw_item_name(item, x + 2, y + (line_height+8) * i-8)
  129.     end
  130.   end
  131. end

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2017-1-9
帖子
12
2
发表于 2017-2-27 10:48:00 | 只看该作者
那怎么给想要的物品弄上想要的品质

点评

在物品备注,写入:品质[颜色],例如:品质[紫]  发表于 2017-2-28 11:49
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 05:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表