/// <summary> /// Draw the label. /// </summary> public override void OnFill(BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols) { if (mFont == null) { return; } MakePositionPerfect(); Pivot p = pivot; int offset = verts.size; Color col = color; col.a *= mPanel.alpha; if (font.premultipliedAlpha) { col = NGUITools.ApplyPMA(col); } EmojiPosList.Clear(); // Print the text into the buffers if (p == Pivot.Left || p == Pivot.TopLeft || p == Pivot.BottomLeft) { mFont.EmojiPrint(processedText, col, verts, uvs, cols, mEncoding, mSymbols, UIFont.Alignment.Left, 0, mPremultiply, mSpacingX, mSpacingY, EmojiMap, EmojiPosList); } else if (p == Pivot.Right || p == Pivot.TopRight || p == Pivot.BottomRight) { mFont.EmojiPrint(processedText, col, verts, uvs, cols, mEncoding, mSymbols, UIFont.Alignment.Right, Mathf.RoundToInt(relativeSize.x * mFont.size), mPremultiply, mSpacingX, mSpacingY, EmojiMap, EmojiPosList); } else { mFont.EmojiPrint(processedText, col, verts, uvs, cols, mEncoding, mSymbols, UIFont.Alignment.Center, Mathf.RoundToInt(relativeSize.x * mFont.size), mPremultiply, mSpacingX, mSpacingY, EmojiMap, EmojiPosList); } // Apply an effect if one was requested if (effectStyle != Effect.None) { Vector3 scale = cachedTransform.localScale; if (scale.x == 0f || scale.y == 0f) { return; } int end = verts.size; float pixel = 1f / mFont.size; float fx = pixel * mEffectDistance.x; float fy = pixel * mEffectDistance.y; ApplyShadow(verts, uvs, cols, offset, end, fx, -fy); if (effectStyle == Effect.Outline) { offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, -fx, fy); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, fx, fy); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, -fx, -fy); } } //表情处理 mTopLeftX = cachedTransform.localPosition.x; mTopLeftY = cachedTransform.localPosition.y; var pixelWidth = relativeSize.x * cachedTransform.localScale.x; var pixelHeight = relativeSize.y * cachedTransform.localScale.y; if (p == Pivot.Top) { mTopLeftX -= pixelWidth / 2f; } else if (p == Pivot.TopRight) { mTopLeftX -= pixelWidth; } else if (p == Pivot.Bottom) { mTopLeftX -= pixelWidth / 2f; mTopLeftY += pixelHeight; } else if (p == Pivot.BottomLeft) { mTopLeftY += pixelHeight; } else if (p == Pivot.BottomRight) { mTopLeftX -= pixelWidth; mTopLeftY += pixelHeight; } else if (p == Pivot.Left) { mTopLeftY += pixelHeight / 2f; } else if (p == Pivot.Center) { mTopLeftX -= pixelWidth / 2f; mTopLeftY += pixelHeight / 2f; } else if (p == Pivot.Right) { mTopLeftX -= pixelWidth; mTopLeftY += pixelHeight / 2f; } StartCoroutine(UpdateEmoji()); }