本文整理汇总了C#中UILabel.MakePixelPerfect方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.MakePixelPerfect方法的具体用法?C# UILabel.MakePixelPerfect怎么用?C# UILabel.MakePixelPerfect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILabel
的用法示例。
在下文中一共展示了UILabel.MakePixelPerfect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawProperties
protected override bool DrawProperties ()
{
mLabel = mWidget as UILabel;
ComponentSelector.Draw<UIFont>(mLabel.font, OnSelectFont);
if (mLabel.font != null)
{
GUI.skin.textArea.wordWrap = true;
string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text;
text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f));
if (!text.Equals(mLabel.text)) { RegisterUndo(); mLabel.text = text; }
GUILayout.BeginHorizontal();
int len = EditorGUILayout.IntField("Max Width", mLabel.lineWidth, GUILayout.Width(120f));
GUILayout.Label("pixels");
GUILayout.EndHorizontal();
if (len != mLabel.lineWidth) { RegisterUndo(); mLabel.lineWidth = len; }
int count = EditorGUILayout.IntField("Max Lines", mLabel.maxLineCount, GUILayout.Width(100f));
if (count != mLabel.maxLineCount) { RegisterUndo(); mLabel.maxLineCount = count; }
GUILayout.BeginHorizontal();
bool shrinkToFit = EditorGUILayout.Toggle("Shrink to Fit", mLabel.shrinkToFit, GUILayout.Width(100f));
GUILayout.Label("- adjust scale to fit");
GUILayout.EndHorizontal();
if (shrinkToFit != mLabel.shrinkToFit)
{
RegisterUndo();
mLabel.shrinkToFit = shrinkToFit;
if (!shrinkToFit) mLabel.MakePixelPerfect();
}
GUILayout.BeginHorizontal();
bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(100f));
GUILayout.Label("- hide characters");
GUILayout.EndHorizontal();
if (password != mLabel.password) { RegisterUndo(); mLabel.password = password; }
GUILayout.BeginHorizontal();
bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
GUILayout.Label("- use emoticons and colors");
GUILayout.EndHorizontal();
if (encoding != mLabel.supportEncoding) { RegisterUndo(); mLabel.supportEncoding = encoding; }
//GUILayout.EndHorizontal();
if (encoding && mLabel.font.hasSymbols)
{
UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f));
if (sym != mLabel.symbolStyle) { RegisterUndo(); mLabel.symbolStyle = sym; }
}
GUILayout.BeginHorizontal();
{
UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
if (effect != mLabel.effectStyle) { RegisterUndo(); mLabel.effectStyle = effect; }
if (effect != UILabel.Effect.None)
{
Color c = EditorGUILayout.ColorField(mLabel.effectColor);
if (mLabel.effectColor != c) { RegisterUndo(); mLabel.effectColor = c; }
}
}
GUILayout.EndHorizontal();
if (mLabel.effectStyle != UILabel.Effect.None)
{
GUILayout.Label("Distance", GUILayout.Width(70f));
GUILayout.Space(-34f);
GUILayout.BeginHorizontal();
GUILayout.Space(70f);
Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance);
GUILayout.Space(20f);
if (offset != mLabel.effectDistance)
{
RegisterUndo();
mLabel.effectDistance = offset;
}
GUILayout.EndHorizontal();
}
return true;
}
EditorGUILayout.Space();
return false;
}
示例2: Awake
void Awake()
{
label = gameObject.GetComponent<UILabel>();
line = VectorLine.SetLine (Color.gray, Vector2.zero, Vector2.zero);
active = false;
label.MakePixelPerfect();
}