Project1
标题:
关于影子脚本判断
[打印本页]
作者:
夕仔
时间:
2014-8-3 13:25
标题:
关于影子脚本判断
使用下面的脚本就可以显示影子,通过文档里面两行数值 来偏离影子的位置。如何增加个新功能,就是不显示影子。比如没有新建文本就不显示影子
也就是说默认不显示,当新建了文档就显示
# 脚本来自www.66rpg.com,使用请保留此信息
# 作者:SailCat;升级:柳柳;最后升级日期:2006年4月30日
#======================================================================
class Bitmap
unless $OK
alias sailcat_draw_text draw_text
def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
end
end
color_temp = self.font.color.clone
if shadow_direction != 0
self.font.color = shadow_color
case shadow_direction
when 1
sailcat_draw_text(x-1, y+1, width, height, text, align)
when 3
sailcat_draw_text(x+1, y+1, width, height, text, align)
when 7
sailcat_draw_text(x-1, y-1, width, height, text, align)
when 9
sailcat_draw_text(x+1, y-1, width, height, text, align)
end
self.font.color = color_temp
end
$OK = true
sailcat_draw_text(x, y, width, height, text, align)
end
end
end
复制代码
作者:
恐惧剑刃
时间:
2014-8-3 15:27
# 脚本来自www.66rpg.com,使用请保留此信息
# 作者:SailCat;升级:柳柳;最后升级日期:2006年4月30日
#======================================================================
#使用方法 draw_text_shadow 仅仅 方法名称有所变化,其余与draw_text同
#draw_text_shadow描绘的文字都有投影 而 draw_text 描绘的文字没有投影!
class Bitmap
unless $OK
#alias sailcat_draw_text draw_text
def draw_text_shadow(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.99)
end
end
color_temp = self.font.color.clone
if shadow_direction != 0
self.font.color = shadow_color
case shadow_direction
when 1
draw_text(x-1, y+1, width, height, text, align)
when 3
draw_text(x+1, y+1, width, height, text, align)
when 7
draw_text(x-1, y-1, width, height, text, align)
when 9
draw_text(x+1, y-1, width, height, text, align)
end
self.font.color = color_temp
end
$OK = true
draw_text(x, y, width, height, text, align)
end
end
end
复制代码
至于文本什么的自己写个判断分歧就好了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1