コード例 #1
0
        /// <summary>
        /// Applied to TMP_InputField to fix a bug that prevented auto layout from ever
        /// working.
        /// </summary>
        private static bool AssignPositioningIfNeeded_Prefix(TMP_InputField __instance,
                                                             RectTransform ___caretRectTrans, TMP_Text ___m_TextComponent)
        {
            bool cont = true;
            var  crt  = ___caretRectTrans;

            if (___m_TextComponent != null && crt != null && __instance != null &&
                ___m_TextComponent.isActiveAndEnabled)
            {
                var rt = ___m_TextComponent.rectTransform;
                if (crt.localPosition != rt.localPosition ||
                    crt.localRotation != rt.localRotation ||
                    crt.localScale != rt.localScale ||
                    crt.anchorMin != rt.anchorMin ||
                    crt.anchorMax != rt.anchorMax ||
                    crt.anchoredPosition != rt.anchoredPosition ||
                    crt.sizeDelta != rt.sizeDelta ||
                    crt.pivot != rt.pivot)
                {
                    __instance.StartCoroutine(ResizeCaret(crt, rt));
                    cont = false;
                }
            }
            return(cont);
        }