查看: 3581|回复: 0
打印 上一主题 下一主题

Unity3d 描边字和阴影字一个简单制作方法

[复制链接]

435

主题

2

听众

6371

积分

高级设计师

Rank: 6Rank: 6

纳金币
6372
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-8-27 11:59:45 |只看该作者 |倒序浏览
描边字有啥好处呢?在游戏里,场景是活动的,如果用单色的字,有些时候是看不清的。
比如你显示的字是浅色,场景切换到太阳,字就看不清了,如果是深色,切换到晚上,
也看不清了。用描边的字就能解决这个问题,很多游戏也都在用。



function OnGUI(){

      GUI.skin=chineseSkin;

      //GUI.Button(Rect(10,10,100,40),show);

      var color = Color (0.6, 0.1, 0.5, 1); //文字颜色

      var pcolor = Color (1, 1, 1, 1); //描边颜色

      var pos=Rect(10,10,100,40) ;

      MakeStroke(pos, "你好", color, pcolor, 1);

}

function MakeStroke(position : Rect, txt:String, txtColor, outlineColor, outlineWidth ){

    position.y-=outlineWidth;

    GUI.color=outlineColor;

    GUI.Label(position, txt);

    position.y+=outlineWidth*2;

    GUI.Label(position, txt);

    position.y-=outlineWidth;

    position.x-=outlineWidth;

    GUI.Label(position, txt);

    position.x+=outlineWidth*2;

    GUI.Label(position, txt);

    position.x-=outlineWidth;

    GUI.color=txtColor;

    GUI.Label(position, txt);

}





分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-9-20 12:11 , Processed in 0.106141 second(s), 32 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部