本文整理汇总了C#中UIFont.MarkAsChanged方法的典型用法代码示例。如果您正苦于以下问题:C# UIFont.MarkAsChanged方法的具体用法?C# UIFont.MarkAsChanged怎么用?C# UIFont.MarkAsChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIFont
的用法示例。
在下文中一共展示了UIFont.MarkAsChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInspectorGUI
//.........这里部分代码省略.........
ComponentSelector.Draw<UIAtlas>(mFont.atlas, OnSelectAtlas, true);
if (mFont.atlas != null)
{
if (mFont.bmFont.isValid)
{
NGUIEditorTools.DrawAdvancedSpriteField(mFont.atlas, mFont.spriteName, SelectSprite, false);
}
EditorGUILayout.Space();
}
else
{
// No atlas specified -- set the material and texture rectangle directly
Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;
if (mFont.material != mat)
{
NGUIEditorTools.RegisterUndo("Font Material", mFont);
mFont.material = mat;
}
}
// For updating the font's data when importing from an external source, such as the texture packer
bool resetWidthHeight = false;
if (mFont.atlas != null || mFont.material != null)
{
TextAsset data = EditorGUILayout.ObjectField("Import Data", null, typeof(TextAsset), false) as TextAsset;
if (data != null)
{
NGUIEditorTools.RegisterUndo("Import Font Data", mFont);
BMFontReader.Load(mFont.bmFont, NGUITools.GetHierarchy(mFont.gameObject), data.bytes);
mFont.MarkAsChanged();
resetWidthHeight = true;
Debug.Log("Imported " + mFont.bmFont.glyphCount + " characters");
}
}
if (mFont.bmFont.isValid)
{
Texture2D tex = mFont.texture;
if (tex != null && mFont.atlas == null)
{
// Pixels are easier to work with than UVs
Rect pixels = NGUIMath.ConvertToPixels(mFont.uvRect, tex.width, tex.height, false);
// Automatically set the width and height of the rectangle to be the original font texture's dimensions
if (resetWidthHeight)
{
pixels.width = mFont.texWidth;
pixels.height = mFont.texHeight;
}
// Font sprite rectangle
pixels = EditorGUILayout.RectField("Pixel Rect", pixels);
// Convert the pixel coordinates back to UV coordinates
Rect uvRect = NGUIMath.ConvertToTexCoords(pixels, tex.width, tex.height);
if (mFont.uvRect != uvRect)
{
NGUIEditorTools.RegisterUndo("Font Pixel Rect", mFont);
mFont.uvRect = uvRect;
}