UIFont里使用Symbols来指定字体时用Sprite前缀和名字自动分配的工具,前段时间工作需要时写的,具体用法有空时再写。

using UnityEngine;
using UnityEditor;
using System.Collections.Generic; public class ParseFontAtlasWindow : EditorWindow
{
[MenuItem ("CustomTools/ParseFontAtlasWindow")]
static void Init ()
{
ParseFontAtlasWindow window = (ParseFontAtlasWindow)EditorWindow.GetWindow (typeof (ParseFontAtlasWindow));
window.Show();
} string atlasPrefix = string.Empty; void OnGUI ()
{
atlasPrefix = EditorGUILayout.TextField(atlasPrefix);
if (GUILayout.Button("ParseAtlas"))
{
UIFont tempFont = GetSelectedFont(); UIAtlas tempAtlas = tempFont.atlas;
foreach(UISpriteData tempSpriteData in tempAtlas.spriteList)
{
if( tempSpriteData.name.StartsWith(atlasPrefix)) tempFont.AddSymbol(tempSpriteData.name.Remove(,atlasPrefix.Length), tempSpriteData.name);
}
tempFont.MarkAsChanged();
} if (GUILayout.Button("ClearSymbol"))
{
UIFont tempFont = GetSelectedFont();
if(tempFont == null) return;
tempFont.symbols.Clear();
tempFont.MarkAsChanged();
} if (GUILayout.Button("Active"))
{
UIFont tempFont = GetSelectedFont();
if (tempFont == null) return;
if (tempFont.bmFont.isValid) return;
tempFont.bmFont.glyphs.Add(new BMGlyph());
tempFont.MarkAsChanged();
}
} UIFont GetSelectedFont()
{
UIFont result = null;
if(Selection.activeGameObject != null)
{
result = Selection.activeGameObject.GetComponent<UIFont> ();
}
return result;
} }

NGUI图集字体的更多相关文章

  1. 利用BMFont和NGUI制作字体集

    Unity中常常需要制作字体,也算是Unity的基本优势吧!其实质就是BMFont和NGUI制作字体.这里把步骤介绍一下: 1.先下载BMFont这个工具 2.Font Settings  设置:(1 ...

  2. 制作NGUI动态字体

    在ngui中有两种制做字体的方式.一种是bmfont等工具制作字体图集的方法,这样的方法呢是动态的.生成的图集有多个字就是多少个字,要多加一 个字要又一次用工具做一次,非常是麻烦. 而汉字有太多,我们 ...

  3. NGUI制作字体的三种方法

    主要参考两篇博文: (1).NGUI制作字体的三种方法 (2).使用位图字体工具BMFont从图片生成自定义字体 1.BMFont下载地址 http://www.angelcode.com/produ ...

  4. Unity3d通用工具类之NGUI图集分解

    ---恢复内容开始--- Unity3d通用工具类之NGUI图集分解 由于最近需要一些美术资源吗,但是无奈自己不会制作UI,所以就打算去网上的项目中直接找几张可以使用的贴图资源. 但是发现这些资源已经 ...

  5. NGUI图集切割代码

    原地址:http://blog.csdn.net/u011440375/article/details/9707491 因为最近工作用NGUI比较多,修改图集时还没原图,有时候需要把图集重新切割开来, ...

  6. NGUI动态字体的使用

    LZ今年六月刚刚毕业,在学校跟着老师做Android,OpenGL ES方面的项目(说白了就是干苦力╮(╯_╰)╭).年后来SZ了,就业前景好像并没有电视上渲染的那样糟糕,至少IT行业是这样吧,只要你 ...

  7. NGUI 动态字体边缘模糊,毛边的问题解决办法

    NGUI支持生成动态字体,将ttf格式的字体文件拖入工程,用NGUIFontMaker制作即可,但是制作完之后会发现字体有毛边,边缘模糊. 这时选中你生成的字体预设,在该预设的UIFont脚本上更改P ...

  8. NGUI的字体加粗效果

    ngui的UILabel可以通过属性面板(inspector)设置字体的样式:加粗 倾斜 正常等. 但是如果通过这里设置了加粗,与实际的加粗不一样,ngui有一个拉伸宽度的变化. 这让人觉得很丑 .如 ...

  9. 解决切换场景时NGUI图集资源未释放的问题

    使用unity3d编辑器,在切换场景的时候.NGUI的图集没有释放造成内存不足游戏闪退的问题. 默认情况下,unity3d切换场景之后会释放不用的内存,即内部会调用Resources.UnloadUn ...

随机推荐

  1. OC 单例实现

    2. 在.h 文件遵循 <NSCopying,NSMutabalecopying> 3.定义宏,实现任意类型单单例 #define SingleH(name) +(instancetype ...

  2. [leetcode]560. Subarray Sum Equals K 和为K的子数组

    Given an array of integers and an integer k, you need to find the total number of continuous subarra ...

  3. 1、HttpClient初探

    HttpClient是它的核心接口.可以理解为一个简单的浏览器. 主要方法有: getParams();   获取运行参数 getConnectionManager(); 获取连接管理器.连接管理器中 ...

  4. APP自动化测试怎么测?

    一般来说工具还有技术都是千篇一律 测试测到最后还是业务能力...

  5. DB2自增长ID

    建议类似的应用采用sequence对象,将来的应用维护和数据迁移会很方便.考虑的因素较少. 对于序列可以使用nextval和prevval来获得下一个和上一个值:CREATE SEQUENCE seq ...

  6. 【转】MapReduce:详解Shuffle过程

    ——转自:{http://langyu.iteye.com/blog/992916} Shuffle过程是MapReduce的核心,也被称为奇迹发生的地方.要想理解MapReduce, Shuffle ...

  7. Deployment is out of date due to changes in the underlying project contents. Deployment is out of date due to changes in the underlying project contents. You'll need to manually 'Redeploy' the projec

    原因1:导入的jar包路径不对,造成第一个错误, 原因2:设置右键工程->属性->myeclipse->web->deployment选use workbenk defaul ...

  8. 日期 时间选择器(DatePicker和TimePicker)实现用户选择

    日期和时间 作者的设计TimePicker时,大小分布不合理,我调整宽度为match-parent高度为wrap-parent就可以了. public class MainActivity exten ...

  9. PHP中的mb_convert_encoding与iconv函数介绍

    php传输乱码 mb_convert_encoding这个函数是用来转换编码的.原来一直对程序编码这一概念不理解,不过现在好像有点开窍了. 不过英文一般不会存在编码问题,只有中文数据才会有这个问题.比 ...

  10. 12) maven-compiler-plugin

    The Compiler Plugin is used to compile the sources of your project. At present the default source se ...