| 赞 | 4 |
| VIP | |
| 好人卡 | |
| 积分 | 6 |
| 经验 | |
| 最后登录 | 2018-4-23 |
| 在线时间 | 830 小时 |
- 梦石
- 0
- 星屑
- 644
- 在线时间
- 830 小时
- 注册时间
- 2016-7-24
- 回帖
- 644

|
发表于 2016-10-25 20:49:31
|
显示全部楼层
- #==============================================================================
- # ■ 物品颜色描绘 Ver.1.3 - By 柍若
- # ItemLevelDrawer
- #------------------------------------------------------------------------------
- # Item类窗口中给图标描绘彩色边框以表示品质等级,同时改变名称颜色。
- # 物品、技能、装备等适用。
- #==============================================================================
- #
- # - 2014.02.05 By 柍若
- # * [ BUG修正 ]重定义品质判定算法,兼容性更良。
- # * [ 优化 ]简化写法(基本是重写了)。
- # * [ 补充 ]无限扩张品级数目。支持自定义。
- # * [ 补充 ]添加背景块,支持不透明度设定。
- # * [ 新功能 ]美化品质框,可选圆角或方角形状。
- # * [ 优化 ]修正名称文字显示位置。
- # * [ 新功能 ]定义全局自动/ 手动描绘两种模式可切换。
- # * [ 新功能 ]物品名称可用控制符。
- #
- #------------------------------------------------------------------------------
- # 基于以下脚本
- # 改写已取得两位作者同意
- #==============================================================================
- # - 2012.01.03 By 仲秋启明
- # * 修改为VA定义
- # - 2011.12.27 By 仲秋启明
- # * 移植至RGSS3,遵循PS0协议;
- # * 优化数据库备注中设定方法
- # - 2011.08.22 By 冰舞蝶恋
- # * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
- # - 2010.08.06 By 仲秋启明
- # * 蓝本(物品颜色描绘脚本(完整无冲突版))
- #------------------------------------------------------------------------------
- # [使用说明]
- # - 替换原Window_Base中的draw_item_name定义或复制到Main之前
- #------------------------------------------------------------------------------
- # [使用方法]
- # - 在备注栏内填写"<品质 n>",其中n表示品质等级。
- #==============================================================================
- module ItemLevelDrawer
- #==============================================================================
-
- # true: 默认全局描绘 / false: 手动设置描绘
-
- WhenZero = true # 开启则当品质为0(即不填)时,默认描绘品质1颜色
- #------------------------------------------------------------------------------
- # true: 圆角 / false: 方角
-
- CornerShape = true
- #------------------------------------------------------------------------------
- # 背景块不透明度
-
- BackOpacity = 160
- #------------------------------------------------------------------------------
-
- # 各品质颜色设置,预设7种,可自行添加新品级
- # 数据库设定的品质大于下列品质的最大值时,将不描绘品质
-
- ColorSet = [[255, 255, 255], # 备注 <品质 1> 或不填 [ 白 ]
-
- [128, 255, 128], # 备注 <品质 2> [ 绿 ]
-
- [128, 128, 255], # 备注 <品质 3> [ 蓝 ]
-
- [255, 0, 255], # 备注 <品质 4> [ 紫 ]
-
- [255, 128, 128], # 备注 <品质 5> [ 红 ]
-
- [255, 128, 0], # 备注 <品质 6> [ 橙 ]
-
- [255, 255, 128], # 备注 <品质 7> [ 黄 ]
-
- ]
- #==============================================================================
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_ItemList < Window_Selectable
- def col_max
- return 1
- end
- end
- class Window_Base < Window
- alias din2 draw_item_name
- def draw_item_name(item, x, y, enabled = true, width = 172)
- return unless item
- n = $1.to_i if /<品质 (\d+?)>/i =~ item.note
- x += 2
- return din2(item, x, y, enabled, width) unless n or ItemLevelDrawer::WhenZero and n.to_i <= ItemLevelDrawer::ColorSet.size
- n -= 1 if n and n >= 1
- n = 0 unless n
- n = ItemLevelDrawer::ColorSet[n.to_i]
- self.contents.fill_rect(x+1, y+2, 22, 20, Color.new(n[0], n[1], n[2], ItemLevelDrawer::BackOpacity))
- s = 1 if ItemLevelDrawer::CornerShape
- self.contents.fill_rect(x+s.to_i, y+1, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
- self.contents.fill_rect(x, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
- self.contents.fill_rect(x+s.to_i, y+22, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
- self.contents.fill_rect(x+23, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
- draw_icon(item.icon_index, x, y, enabled)
- change_color(Color.new(n[0], n[1], n[2]), enabled)
- draw_text_ex(x + 30, y, item.name, Color.new(n[0], n[1], n[2]))
- end
- def draw_text_ex(x, y, text, initial_color = normal_color)
- reset_font_settings(initial_color)
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- def reset_font_settings(initial_color = normal_color)
- change_color(initial_color)
- contents.font.size = Font.default_size
- contents.font.bold = Font.default_bold
- contents.font.italic = Font.default_italic
- end
- end
- #==============================================================================
- # End of Script
- #==============================================================================
复制代码 |
评分
-
查看全部评分
|