赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 17573 |
最后登录 | 2020-3-13 |
在线时间 | 304 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 138
- 在线时间
- 304 小时
- 注册时间
- 2014-4-11
- 帖子
- 419
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这个物品绘色的基本不兼容所有的技能脚本 比如技能升级
其他不兼容的脚本也特别多 只要是有绘色的好像都不太对
有木有人能帮忙改一下或者告诉我怎么解决?
附上脚本
#———————————————————————————————————————— # ●ITEM_LV By.Clov # *物品等级颜色描绘 # *Ver1.1 Date:2013.9.17 # *Ver1.2 Date:2013.9.24 # *Ver1.3 Date:2013.9.24 # *Ver1.4 Date:2013.10.10 # *Ver1.5 Date:2013.10.12 # *Ver1.6 Date:2013.10.17 #———————————————————————————————————————— module ITEM_LV ITEM_NAME = true #物品名是否也绘色 关闭的话建议关闭ITEM_GFR ITEM_GFR = :UD #物品名绘色使用渐变色:LR 左右/:UD 上下/nil关闭 ITEM_ENA = true #物品名、图标没有“无效透明” ITEM_TYPE = nil#:W #背景描绘类型:W 横向 :H纵向 ITEM_SYM = ["[]",nil] #设置取得等级的头尾字符 nil为内部字符 ITEM_BACK_WIDTH = 172 #背景显示宽度(nil同步物品名宽度) ITEM_BACK_BBL = 0.5 #背景透明渐变的长度(0.1-0.5) ITEM_COLOR={ "wh"=>Color.new(230,230,230,160), #等级1 白色 "bl"=>Color.new(1,108,254,160), #等级2 蓝色 "gr"=>Color.new(2,224,33,160), #等级3 绿色 "go"=>Color.new(246,255,3,160), #等级4 金色 "pe"=>Color.new(234,3,255,160), #等级5 紫色 "bo"=>Color.new(254,37,52,160), #等级6 红色 "cj"=>Color.new(2,253,209,160), #等级0 成就徽章-湖蓝色 "神话"=>Color.new(rand(255),rand(255),rand(255),160) #神话级 测试颜色 } end #———————————————————————————————————————— # ●Window_Base #———————————————————————————————————————— class Window_Base < Window #——————————————————————————————————————— #绘制物品名称 #enabled : 有效的标志。false 的时候使用半透明效果绘制 #——————————————————————————————————————— def draw_item_name(item, x, y, enabled=true, width=ITEM_LV::ITEM_BACK_WIDTH) return unless item #有效度总开关 enabled = ITEM_LV::ITEM_ENA ? ITEM_LV::ITEM_ENA : enabled #·等级绘制 f1 = ITEM_LV::ITEM_SYM[0] ; f2 = ITEM_LV::ITEM_SYM[-1] item_lv = item.note.sten(f1, f2) ; if item_lv #等级背景宽为设定值 if width ; w = width #等级背景宽同步物品名 else ; w = contents.text_size(item.name).width+24 ; end #绘制等级背景 item_lv = item_lv.to_i != 0 ? item_lv.to_i : item_lv color = ITEM_LV::ITEM_COLOR[item_lv] case ITEM_LV::ITEM_TYPE when:W;contents.back_w(x,y,w,line_height,ITEM_LV::ITEM_BACK_BBL,color) when:H;contents.back_h(x,y,w,line_height,ITEM_LV::ITEM_BACK_BBL,color);end #物品名绘色 contents.font.color = ITEM_LV::ITEM_NAME ? color : normal_color contents.font.color.alpha = enabled ? 255 : 160 #·默认绘制 else ; w = width ; change_color(normal_color, enabled) ; end #绘制图标 draw_icon(item.icon_index, x, y, enabled) #绘制物品名 case ITEM_LV::ITEM_GFR when nil ; draw_text(x + 24, y, w, line_height, item.name) when :LR ; item_name_gfr_text(x + 24, y, item.name,false) when :UD ; item_name_gfr_text(x + 24, y, item.name,true) ; end end #——————————————————————————————————————— #绘制渐变物品名称 #——————————————————————————————————————— def item_name_gfr_text(x, y, text, vertical) color1 = contents.font.color color2 = Color.new(color1.red+80,color1.green+80,color1.blue+80) contents.gfr_text_pix(x, y,color1,color2, text, vertical) end end #———————————————————————————————————————— # ●String # *提取指定字符内容 # *使用 "<name:abc123>".sten("<>","name:") >> "abc123" # -se为起始终点字符 必须指定两个字符字符作为起始点 # -sym为内容标识字符 忽略的话只读第一个匹配sn的内容 #———————————————————————————————————————— class String #——————————————————————————————————————— def sten(se,sym=nil) if sym ; s,e = se[0]<<sym,se[1] ; f = self.split(s)[1] return nil unless f && f.index(e) ; f[0,f.index(e)] ; else s,e = se[0],se[1] ; f = self ; i0 = f.index(s) ; i1 = f.index(e) return nil unless i0 && i1 ; f[i0+1,i1-i0-1] ; end end #——————————————————————————————————————— def resten ; /<SYM(.*?)>/ =~ self ; $1 ; end #——————————————————————————————————————— end #———————————————————————————————————————— # ●位图的追加绘制方法 # *渐透明描绘以及RGSS1用gradient_fill_rect #———————————————————————————————————————— class Bitmap #——————————————————————————————————————— # ● 渐透明描绘(宽) #——————————————————————————————————————— def back_w(x,y,w,h,bl=0.3,c=Color.new(0,200,230,128)) r = c.red ; g = c.green ; b = c.blue ; o = c.alpha l = (w*bl).round all = [l,w-l*2,l] all.each_index {|i| ; w2 = all[i] case i when 0 ; x2 = 0 ; o1 = 0 ; o2 = o when 1 ; x2 = all[0] ; o1 = o2 = o when 2 ; x2 = all[0] + all[1] ; o1 = o ; o2 = 0 ; end c1 = Color.new(r,g,b,o1) ; c2 = Color.new(r,g,b,o2) gradient_fill_rect(x+x2, y, w2, h, c1, c2) if w2 > 0 } end #——————————————————————————————————————— # ● 渐透明描绘(高) #——————————————————————————————————————— def back_h(x,y,w,h,bl=0.3,c=Color.new(0,200,230,128)) r = c.red ; g = c.green ; b = c.blue ; o = c.alpha l = (h*bl).round all = [l,h-l*2,l] all.each_index {|i| ; h2 = all[i] case i when 0 ; y2 = 0 ; o1 = 0 ; o2 = o when 1 ; y2 = all[0] ; o1 = o2 = o when 2 ; y2 = all[0] + all[1] ; o1 = o ; o2 = 0 ; end c1 = Color.new(r,g,b,o1) ; c2 = Color.new(r,g,b,o2) gradient_fill_rect(x, y+y2, w, h2, c1, c2, true) if h2 > 0 } end end #———————————————————————————————————————— # ●GFR_TEXT(VA) By.Clov # *横向、纵向渐变描绘文字 # -Ver:1.0 Date:2013.10.12 # -Ver:1.1 Date:2013.10.17 优化gfr_text_pix # *使用: # -gfr_text_pix(x, y, color1, color2, text, vertica) # -gfr_text_blt(x, y, color1, color2, text, vertica) # -x:x坐标 y:y坐标 color1:左、上颜色 color2:右、下颜色 # -text:字符串 vertica:false/左右渐变 true/上下渐变 # *gfr_text_pix效率优先取消了渐变透明功能 gfr_text_blt保留全部功能 #———————————————————————————————————————— class Bitmap def gfr_text_pix(x, y, color1, color2, text, vertical = false) r1 = color1.red;g1 = color1.green;b1 = color1.blue;o1 = color1.alpha r2 = color2.red;g2 = color2.green;b2 = color2.blue;o2 = color2.alpha case vertical when false ts = text_size(text) ; width,height = ts.width+2,ts.height bit = self.dup ; bit.font = font.dup ; bit.font.outline = false bit.clear ; bit.draw_text(x, y, width, height, text) if font.outline ; fc = font.color.dup ; font.color = Color.new(0,0,0) draw_text(x, y, width, height, text) ; font.color = fc ; end w = (width-1).to_f;plus_r = (r2-r1)/w;plus_g = (g2-g1)/w plus_b = (b2-b1)/w;plus_o = (o2-o1)/w;width.times {|k| height.times {|i| o = bit.get_pixel(x+k,y+i).alpha bit.set_pixel(x+k,y+i,Color.new(r1,g1,b1,o)) if o > 0} r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o} blt(x, y ,bit,Rect.new(x,y,width,height)) ; bit.dispose when true ts = text_size(text) ; width,height = ts.width+2,ts.height bit = self.dup ; bit.font = font.dup ; bit.font.outline = false bit.clear ; bit.draw_text(x, y, width, height, text) if font.outline ; fc = font.color.dup ; font.color = Color.new(0,0,0) draw_text(x, y, width, height, text) ; font.color = fc ; end h = (height-1).to_f;plus_r = (r2-r1)/h;plus_g = (g2-g1)/h plus_b = (b2-b1)/h;plus_o = (o2-o1)/h;height.times {|i| width.times {|k| o = bit.get_pixel(x+k,y+i).alpha bit.set_pixel(x+k,y+i,Color.new(r1,g1,b1,o)) if o > 0} r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o} blt(x, y ,bit,Rect.new(x,y,width,height)) ; bit.dispose end end #——————————————————————————————————————— def gfr_text_blt(x, y, color1, color2, text, vertical = false) r1 = color1.red;g1 = color1.green;b1 = color1.blue;o1 = color1.alpha r2 = color2.red;g2 = color2.green;b2 = color2.blue;o2 = color2.alpha case vertical when false ts = text_size(text) ; width,height = ts.width+2,ts.height bit = self.dup ; bit.font = font.dup w = (width-1).to_f;plus_r = (r2-r1)/w;plus_g = (g2-g1)/w plus_b = (b2-b1)/w;plus_o = (o2-o1)/w;width.times {|k| bit.font.color = Color.new(r1,g1,b1,o1) bit.draw_text(x, y, width, height, text) blt(x+k, y ,bit,Rect.new(x+k,y,1,height)) bit.clear;r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o};bit.dispose when true ts = text_size(text) ; width,height = ts.width+2,ts.height bit = self.dup ; bit.font = font.dup h = (height-1).to_f;plus_r = (r2-r1)/h;plus_g = (g2-g1)/h plus_b = (b2-b1)/h;plus_o = (o2-o1)/h;height.times {|i| bit.font.color = Color.new(r1,g1,b1,o1) bit.draw_text(x, y, width, height, text) blt(x, y+i ,bit,Rect.new(x,y+i,width,1)) bit.clear;r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o};bit.dispose end end end
#————————————————————————————————————————
# ●ITEM_LV By.Clov
# *物品等级颜色描绘
# *Ver1.1 Date:2013.9.17
# *Ver1.2 Date:2013.9.24
# *Ver1.3 Date:2013.9.24
# *Ver1.4 Date:2013.10.10
# *Ver1.5 Date:2013.10.12
# *Ver1.6 Date:2013.10.17
#————————————————————————————————————————
module ITEM_LV
ITEM_NAME = true #物品名是否也绘色 关闭的话建议关闭ITEM_GFR
ITEM_GFR = :UD #物品名绘色使用渐变色:LR 左右/:UD 上下/nil关闭
ITEM_ENA = true #物品名、图标没有“无效透明”
ITEM_TYPE = nil#:W #背景描绘类型:W 横向 :H纵向
ITEM_SYM = ["[]",nil] #设置取得等级的头尾字符 nil为内部字符
ITEM_BACK_WIDTH = 172 #背景显示宽度(nil同步物品名宽度)
ITEM_BACK_BBL = 0.5 #背景透明渐变的长度(0.1-0.5)
ITEM_COLOR={
"wh"=>Color.new(230,230,230,160), #等级1 白色
"bl"=>Color.new(1,108,254,160), #等级2 蓝色
"gr"=>Color.new(2,224,33,160), #等级3 绿色
"go"=>Color.new(246,255,3,160), #等级4 金色
"pe"=>Color.new(234,3,255,160), #等级5 紫色
"bo"=>Color.new(254,37,52,160), #等级6 红色
"cj"=>Color.new(2,253,209,160), #等级0 成就徽章-湖蓝色
"神话"=>Color.new(rand(255),rand(255),rand(255),160) #神话级 测试颜色
}
end
#————————————————————————————————————————
# ●Window_Base
#————————————————————————————————————————
class Window_Base < Window
#———————————————————————————————————————
#绘制物品名称
#enabled : 有效的标志。false 的时候使用半透明效果绘制
#———————————————————————————————————————
def draw_item_name(item, x, y, enabled=true, width=ITEM_LV::ITEM_BACK_WIDTH)
return unless item
#有效度总开关
enabled = ITEM_LV::ITEM_ENA ? ITEM_LV::ITEM_ENA : enabled
#·等级绘制
f1 = ITEM_LV::ITEM_SYM[0] ; f2 = ITEM_LV::ITEM_SYM[-1]
item_lv = item.note.sten(f1, f2) ; if item_lv
#等级背景宽为设定值
if width ; w = width
#等级背景宽同步物品名
else ; w = contents.text_size(item.name).width+24 ; end
#绘制等级背景
item_lv = item_lv.to_i != 0 ? item_lv.to_i : item_lv
color = ITEM_LV::ITEM_COLOR[item_lv]
case ITEM_LV::ITEM_TYPE
when:W;contents.back_w(x,y,w,line_height,ITEM_LV::ITEM_BACK_BBL,color)
when:H;contents.back_h(x,y,w,line_height,ITEM_LV::ITEM_BACK_BBL,color);end
#物品名绘色
contents.font.color = ITEM_LV::ITEM_NAME ? color : normal_color
contents.font.color.alpha = enabled ? 255 : 160
#·默认绘制
else ; w = width ; change_color(normal_color, enabled) ; end
#绘制图标
draw_icon(item.icon_index, x, y, enabled)
#绘制物品名
case ITEM_LV::ITEM_GFR
when nil ; draw_text(x + 24, y, w, line_height, item.name)
when :LR ; item_name_gfr_text(x + 24, y, item.name,false)
when :UD ; item_name_gfr_text(x + 24, y, item.name,true) ; end
end
#———————————————————————————————————————
#绘制渐变物品名称
#———————————————————————————————————————
def item_name_gfr_text(x, y, text, vertical)
color1 = contents.font.color
color2 = Color.new(color1.red+80,color1.green+80,color1.blue+80)
contents.gfr_text_pix(x, y,color1,color2, text, vertical)
end
end
#————————————————————————————————————————
# ●String
# *提取指定字符内容
# *使用 "<name:abc123>".sten("<>","name:") >> "abc123"
# -se为起始终点字符 必须指定两个字符字符作为起始点
# -sym为内容标识字符 忽略的话只读第一个匹配sn的内容
#————————————————————————————————————————
class String
#———————————————————————————————————————
def sten(se,sym=nil)
if sym ; s,e = se[0]<<sym,se[1] ; f = self.split(s)[1]
return nil unless f && f.index(e) ; f[0,f.index(e)] ; else
s,e = se[0],se[1] ; f = self ; i0 = f.index(s) ; i1 = f.index(e)
return nil unless i0 && i1 ; f[i0+1,i1-i0-1] ; end
end
#———————————————————————————————————————
def resten ; /<SYM(.*?)>/ =~ self ; $1 ; end
#———————————————————————————————————————
end
#————————————————————————————————————————
# ●位图的追加绘制方法
# *渐透明描绘以及RGSS1用gradient_fill_rect
#————————————————————————————————————————
class Bitmap
#———————————————————————————————————————
# ● 渐透明描绘(宽)
#———————————————————————————————————————
def back_w(x,y,w,h,bl=0.3,c=Color.new(0,200,230,128))
r = c.red ; g = c.green ; b = c.blue ; o = c.alpha
l = (w*bl).round
all = [l,w-l*2,l]
all.each_index {|i| ; w2 = all[i]
case i
when 0 ; x2 = 0 ; o1 = 0 ; o2 = o
when 1 ; x2 = all[0] ; o1 = o2 = o
when 2 ; x2 = all[0] + all[1] ; o1 = o ; o2 = 0 ; end
c1 = Color.new(r,g,b,o1) ; c2 = Color.new(r,g,b,o2)
gradient_fill_rect(x+x2, y, w2, h, c1, c2) if w2 > 0 }
end
#———————————————————————————————————————
# ● 渐透明描绘(高)
#———————————————————————————————————————
def back_h(x,y,w,h,bl=0.3,c=Color.new(0,200,230,128))
r = c.red ; g = c.green ; b = c.blue ; o = c.alpha
l = (h*bl).round
all = [l,h-l*2,l]
all.each_index {|i| ; h2 = all[i]
case i
when 0 ; y2 = 0 ; o1 = 0 ; o2 = o
when 1 ; y2 = all[0] ; o1 = o2 = o
when 2 ; y2 = all[0] + all[1] ; o1 = o ; o2 = 0 ; end
c1 = Color.new(r,g,b,o1) ; c2 = Color.new(r,g,b,o2)
gradient_fill_rect(x, y+y2, w, h2, c1, c2, true) if h2 > 0 }
end
end
#————————————————————————————————————————
# ●GFR_TEXT(VA) By.Clov
# *横向、纵向渐变描绘文字
# -Ver:1.0 Date:2013.10.12
# -Ver:1.1 Date:2013.10.17 优化gfr_text_pix
# *使用:
# -gfr_text_pix(x, y, color1, color2, text, vertica)
# -gfr_text_blt(x, y, color1, color2, text, vertica)
# -x:x坐标 y:y坐标 color1:左、上颜色 color2:右、下颜色
# -text:字符串 vertica:false/左右渐变 true/上下渐变
# *gfr_text_pix效率优先取消了渐变透明功能 gfr_text_blt保留全部功能
#————————————————————————————————————————
class Bitmap
def gfr_text_pix(x, y, color1, color2, text, vertical = false)
r1 = color1.red;g1 = color1.green;b1 = color1.blue;o1 = color1.alpha
r2 = color2.red;g2 = color2.green;b2 = color2.blue;o2 = color2.alpha
case vertical
when false
ts = text_size(text) ; width,height = ts.width+2,ts.height
bit = self.dup ; bit.font = font.dup ; bit.font.outline = false
bit.clear ; bit.draw_text(x, y, width, height, text)
if font.outline ; fc = font.color.dup ; font.color = Color.new(0,0,0)
draw_text(x, y, width, height, text) ; font.color = fc ; end
w = (width-1).to_f;plus_r = (r2-r1)/w;plus_g = (g2-g1)/w
plus_b = (b2-b1)/w;plus_o = (o2-o1)/w;width.times {|k|
height.times {|i| o = bit.get_pixel(x+k,y+i).alpha
bit.set_pixel(x+k,y+i,Color.new(r1,g1,b1,o)) if o > 0}
r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o}
blt(x, y ,bit,Rect.new(x,y,width,height)) ; bit.dispose
when true
ts = text_size(text) ; width,height = ts.width+2,ts.height
bit = self.dup ; bit.font = font.dup ; bit.font.outline = false
bit.clear ; bit.draw_text(x, y, width, height, text)
if font.outline ; fc = font.color.dup ; font.color = Color.new(0,0,0)
draw_text(x, y, width, height, text) ; font.color = fc ; end
h = (height-1).to_f;plus_r = (r2-r1)/h;plus_g = (g2-g1)/h
plus_b = (b2-b1)/h;plus_o = (o2-o1)/h;height.times {|i|
width.times {|k| o = bit.get_pixel(x+k,y+i).alpha
bit.set_pixel(x+k,y+i,Color.new(r1,g1,b1,o)) if o > 0}
r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o}
blt(x, y ,bit,Rect.new(x,y,width,height)) ; bit.dispose
end
end
#———————————————————————————————————————
def gfr_text_blt(x, y, color1, color2, text, vertical = false)
r1 = color1.red;g1 = color1.green;b1 = color1.blue;o1 = color1.alpha
r2 = color2.red;g2 = color2.green;b2 = color2.blue;o2 = color2.alpha
case vertical
when false
ts = text_size(text) ; width,height = ts.width+2,ts.height
bit = self.dup ; bit.font = font.dup
w = (width-1).to_f;plus_r = (r2-r1)/w;plus_g = (g2-g1)/w
plus_b = (b2-b1)/w;plus_o = (o2-o1)/w;width.times {|k|
bit.font.color = Color.new(r1,g1,b1,o1)
bit.draw_text(x, y, width, height, text)
blt(x+k, y ,bit,Rect.new(x+k,y,1,height))
bit.clear;r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o};bit.dispose
when true
ts = text_size(text) ; width,height = ts.width+2,ts.height
bit = self.dup ; bit.font = font.dup
h = (height-1).to_f;plus_r = (r2-r1)/h;plus_g = (g2-g1)/h
plus_b = (b2-b1)/h;plus_o = (o2-o1)/h;height.times {|i|
bit.font.color = Color.new(r1,g1,b1,o1)
bit.draw_text(x, y, width, height, text)
blt(x, y+i ,bit,Rect.new(x,y+i,width,1))
bit.clear;r1+=plus_r;g1+=plus_g;b1+=plus_b;o1+=plus_o};bit.dispose
end
end
end
|
|