public ProcessText ( bool legacyMode ) : void | ||
legacyMode | bool | |
return | void |
void ProcessText (bool legacyMode)
{
if (!isValid) return;
mChanged = true;
shouldBeProcessed = false;
NGUIText.rectWidth = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth : 1000000) : width;
NGUIText.rectHeight = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight : 1000000) : height;
mPrintedSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : defaultFontSize);
mScale = 1f;
if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
{
mProcessedText = "";
return;
}
UpdateNGUIText(mPrintedSize, mWidth, mHeight);
bool isDynamic = (trueTypeFont != null);
if (mOverflow == Overflow.ResizeFreely) NGUIText.rectWidth = 1000000;
if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
NGUIText.rectHeight = 1000000;
if (mPrintedSize > 0)
{
#if DYNAMIC_FONT
bool adjustSize = keepCrisp;
#endif
for (int ps = mPrintedSize; ps > 0; --ps)
{
#if DYNAMIC_FONT
// Adjust either the size, or the scale
if (adjustSize)
{
mPrintedSize = ps;
NGUIText.fontSize = mPrintedSize;
}
else
#endif
{
mScale = (float)ps / mPrintedSize;
NGUIText.fontScale = isDynamic ? mScale : ((float)mFontSize / mFont.defaultSize) * mScale * bitmapFont.pixelSize;
}
NGUIText.Update(false);
// Wrap the text
bool fits = NGUIText.WrapText(mText, out mProcessedText, true);
if (mOverflow == Overflow.ShrinkContent && !fits)
{
if (--ps > 1) continue;
else break;
}
else if (mOverflow == Overflow.ResizeFreely)
{
mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
mWidth = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x));
mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
if ((mWidth & 1) == 1) ++mWidth;
if ((mHeight & 1) == 1) ++mHeight;
}
else if (mOverflow == Overflow.ResizeHeight)
{
mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
if ((mHeight & 1) == 1) ++mHeight;
}
else
{
mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
}
// Upgrade to the new system
if (legacyMode)
{
width = Mathf.RoundToInt(mCalculatedSize.x);
height = Mathf.RoundToInt(mCalculatedSize.y);
cachedTransform.localScale = Vector3.one;
}
break;
}
}
else
{
cachedTransform.localScale = Vector3.one;
mProcessedText = "";
mScale = 1f;
}
}
UILabel::ProcessText ( ) : void |
public static void Show(Vector3 position, String message) { if (QuadMistGetCardDialog.main.dialog != (UnityEngine.Object)null) { Singleton <DialogManager> .Instance.ReleaseDialogToPool(QuadMistGetCardDialog.main.dialog); QuadMistGetCardDialog.main.dialog = (Dialog)null; } UILabel dialogLabel = Singleton <DialogManager> .Instance.GetDialogLabel(); Int32 width = dialogLabel.width; dialogLabel.width = Convert.ToInt32(UIManager.UIContentSize.x); dialogLabel.ProcessText(); dialogLabel.UpdateNGUIText(); Int32 num = Convert.ToInt32((NGUIText.CalculatePrintedSize2(message).x + Dialog.DialogPhraseXPadding * 2f) / UIManager.ResourceXMultipier) + 1; dialogLabel.width = width; QuadMistGetCardDialog.main.dialog = Singleton <DialogManager> .Instance.AttachDialog(String.Concat(new Object[] { "[STRT=", num, ",1][CENT][NANI][IMME]", message, "[TIME=-1]" }), 0, 1, Dialog.TailPosition.AutoPosition, Dialog.WindowStyle.WindowStylePlain, new Vector2(10000f, 10000f), Dialog.CaptionType.None); QuadMistGetCardDialog.main.dialog.transform.localPosition = new Vector3(0f, -220f); }