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

Project1

 找回密码
 注册会员
搜索

物品名字和数量显示重叠在了一起

查看数: 1861 | 评论数: 4 | 收藏 2
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-10-25 19:15

正文摘要:

本帖最后由 1046624975 于 2016-10-25 19:33 编辑 新人求教,就像图中的一样,物品名字和数目显示重叠了,有没有什么办法扩大物品名称显示框的长度,希望知道的朋友解答一下,谢谢。 ...

回复

1046624975 发表于 2016-10-26 13:33:39
QQ蚊子湯 发表于 2016-10-25 20:49
#==============================================================================
    #  ■ 物品 ...

非常感谢,问题已经解决。
QQ蚊子湯 发表于 2016-10-25 20:49:31

RUBY 代码复制
  1. #==============================================================================
  2.     #  ■ 物品颜色描绘 Ver.1.3  - By 柍若
  3.     #     ItemLevelDrawer
  4.     #------------------------------------------------------------------------------
  5.     #    Item类窗口中给图标描绘彩色边框以表示品质等级,同时改变名称颜色。
  6.     #     物品、技能、装备等适用。
  7.     #==============================================================================
  8.     #
  9.     #    - 2014.02.05 By 柍若
  10.     #      * [ BUG修正 ]重定义品质判定算法,兼容性更良。   
  11.     #      * [    优化 ]简化写法(基本是重写了)。              
  12.     #      * [    补充 ]无限扩张品级数目。支持自定义。    
  13.     #      * [    补充 ]添加背景块,支持不透明度设定。    
  14.     #      * [  新功能 ]美化品质框,可选圆角或方角形状。   
  15.     #      * [    优化 ]修正名称文字显示位置。          
  16.     #      * [  新功能 ]定义全局自动/ 手动描绘两种模式可切换。
  17.     #      * [  新功能 ]物品名称可用控制符。
  18.     #
  19.     #------------------------------------------------------------------------------
  20.     #      基于以下脚本
  21.     #      改写已取得两位作者同意
  22.     #==============================================================================
  23.     #    - 2012.01.03 By 仲秋启明
  24.     #      * 修改为VA定义
  25.     #    - 2011.12.27 By 仲秋启明
  26.     #      * 移植至RGSS3,遵循PS0协议;
  27.     #      * 优化数据库备注中设定方法
  28.     #    - 2011.08.22 By 冰舞蝶恋
  29.     #      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
  30.     #    - 2010.08.06 By 仲秋启明
  31.     #      * 蓝本(物品颜色描绘脚本(完整无冲突版))
  32.     #------------------------------------------------------------------------------
  33.     # [使用说明]
  34.     #    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
  35.     #------------------------------------------------------------------------------
  36.     # [使用方法]
  37.     #    - 在备注栏内填写"<品质 n>",其中n表示品质等级。
  38.     #==============================================================================
  39.     module ItemLevelDrawer
  40.     #==============================================================================
  41.  
  42.         # true: 默认全局描绘    / false: 手动设置描绘
  43.  
  44.         WhenZero = true   # 开启则当品质为0(即不填)时,默认描绘品质1颜色
  45.     #------------------------------------------------------------------------------
  46.  
  47.         # true: 圆角    / false: 方角
  48.  
  49.         CornerShape = true
  50.     #------------------------------------------------------------------------------
  51.  
  52.         # 背景块不透明度
  53.  
  54.         BackOpacity = 160
  55.     #------------------------------------------------------------------------------
  56.  
  57.         # 各品质颜色设置,预设7种,可自行添加新品级
  58.         # 数据库设定的品质大于下列品质的最大值时,将不描绘品质
  59.  
  60.         ColorSet = [[255, 255, 255],   # 备注 <品质 1> 或不填    [ 白 ]
  61.  
  62.                     [128, 255, 128],   # 备注 <品质 2>        [ 绿 ]
  63.  
  64.                     [128, 128, 255],   # 备注 <品质 3>        [ 蓝 ]
  65.  
  66.                     [255,   0, 255],   # 备注 <品质 4>        [ 紫 ]
  67.  
  68.                     [255, 128, 128],   # 备注 <品质 5>        [ 红 ]
  69.  
  70.                     [255, 128,   0],   # 备注 <品质 6>        [ 橙 ]
  71.  
  72.                     [255, 255, 128],   # 备注 <品质 7>        [ 黄 ]
  73.  
  74.                     ]
  75.     #==============================================================================
  76.     end
  77.     #==============================================================================
  78.     # ■ Window_Base
  79.     #==============================================================================
  80.     class Window_ItemList < Window_Selectable
  81.       def col_max
  82.     return 1
  83.   end
  84.   end
  85.     class Window_Base < Window
  86.       alias din2 draw_item_name
  87.       def draw_item_name(item, x, y, enabled = true, width = 172)
  88.         return unless item
  89.         n = $1.to_i if /<品质 (\d+?)>/i =~ item.note
  90.         x += 2
  91.         return din2(item, x, y, enabled, width) unless n or ItemLevelDrawer::WhenZero and n.to_i <= ItemLevelDrawer::ColorSet.size
  92.         n -= 1 if n and n >= 1
  93.         n = 0 unless n
  94.         n = ItemLevelDrawer::ColorSet[n.to_i]
  95.         self.contents.fill_rect(x+1, y+2, 22, 20, Color.new(n[0], n[1], n[2], ItemLevelDrawer::BackOpacity))
  96.         s = 1 if ItemLevelDrawer::CornerShape
  97.         self.contents.fill_rect(x+s.to_i, y+1, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
  98.         self.contents.fill_rect(x, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
  99.         self.contents.fill_rect(x+s.to_i, y+22, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
  100.         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]))
  101.         draw_icon(item.icon_index, x, y, enabled)
  102.         change_color(Color.new(n[0], n[1], n[2]), enabled)
  103.         draw_text_ex(x + 30, y, item.name, Color.new(n[0], n[1], n[2]))
  104.       end
  105.       def draw_text_ex(x, y, text, initial_color = normal_color)
  106.         reset_font_settings(initial_color)
  107.         text = convert_escape_characters(text)
  108.         pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  109.         process_character(text.slice!(0, 1), text, pos) until text.empty?
  110.       end
  111.       def reset_font_settings(initial_color = normal_color)
  112.         change_color(initial_color)
  113.         contents.font.size = Font.default_size
  114.         contents.font.bold = Font.default_bold
  115.         contents.font.italic = Font.default_italic
  116.       end
  117.     end
  118.     #==============================================================================
  119.     # End of Script
  120.     #==============================================================================

评分

参与人数 1星屑 +250 梦石 +1 收起 理由
RaidenInfinity + 250 + 1 楼主认可的解答

查看全部评分

1046624975 发表于 2016-10-25 19:30:50
QQ蚊子湯 发表于 2016-10-25 19:21
雖然截圖不完整,但是看得出來已經頂到底,所以我建議你可以用這句把那個略顯多餘的冒號消除
class Window_ ...

多谢解答 后面那个是物品的数量 要是去掉了 是不是就不太完整了 有没有可能扩大物品名称框 因为我发现va自带的一些装备词条过长也有这种冲突 我用了一个修改物品颜色的脚本 我发现那个脚本的发补贴上的截图是可以加长物品描述的 https://rpg.blue/forum.php?mod=v ... amp;_dsign=d19dd295 希望能帮我看一下能否修改 辛苦了
QQ蚊子湯 发表于 2016-10-25 19:21:50
雖然截圖不完整,但是看得出來已經頂到底,所以我建議你可以用這句把那個略顯多餘的冒號消除
RUBY 代码复制
  1. class Window_ItemList < Window_Selectable
  2.   def draw_item_number(rect, item)
  3.     draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 2)
  4.   end
  5. end
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-7-20 16:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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