コード例 #1
0
        private static Vector2 DoGetCursorPosition(TextNativeSettings settings, Rect rect, int cursorPosition)
        {
            Vector2 result;

            TextNative.DoGetCursorPosition_Injected(ref settings, ref rect, cursorPosition, out result);
            return(result);
        }
コード例 #2
0
        private static Vector2 DoGetOffset(TextNativeSettings settings, Rect rect)
        {
            Vector2 result;

            TextNative.DoGetOffset_Injected(ref settings, ref rect, out result);
            return(result);
        }
コード例 #3
0
        public static Vector2 GetCursorPosition(TextNativeSettings settings, Rect rect, int cursorIndex)
        {
            if (settings.font == null)
            {
                Debug.LogError("Cannot process a null font.");
                return(Vector2.zero);
            }

            return(DoGetCursorPosition(settings, rect, cursorIndex));
        }
コード例 #4
0
        public static Vector2 GetOffset(TextNativeSettings settings, Rect screenRect)
        {
            if (settings.font == null)
            {
                Debug.LogError("Cannot process a null font.");
                return(new Vector2(0, 0));
            }

            settings.text = settings.text ?? "";

            return(DoGetOffset(settings, screenRect));
        }
コード例 #5
0
        public static unsafe NativeArray <TextVertex> GetVertices(TextNativeSettings settings)
        {
            int vertexCount = 0;

            GetVertices(settings, IntPtr.Zero, UnsafeUtility.SizeOf <TextVertex>(), ref vertexCount);
            var array = new NativeArray <TextVertex>(vertexCount, Allocator.Temp, NativeArrayOptions.UninitializedMemory);

            if (vertexCount > 0)
            {
                GetVertices(settings, (IntPtr)array.GetUnsafePtr(), UnsafeUtility.SizeOf <TextVertex>(), ref vertexCount);
                Debug.Assert(vertexCount == array.Length);
            }
            return(array);
        }
コード例 #6
0
        public NativeArray <TextVertex> GetVertices(MeshGenerationContextUtils.TextParams parms, float scaling)
        {
            int paramsHash = parms.GetHashCode();

            if (m_PreviousTextParamsHash == paramsHash)
            {
                return(textVertices);
            }

            m_PreviousTextParamsHash = paramsHash;
            TextNativeSettings textSettings = MeshGenerationContextUtils.TextParams.GetTextNativeSettings(parms, scaling);

            textVertices = TextNative.GetVertices(textSettings);
            return(textVertices);
        }
コード例 #7
0
        public static NativeArray <TextVertex> GetVertices(TextNativeSettings settings)
        {
            int num = 0;

            TextNative.GetVertices(settings, IntPtr.Zero, UnsafeUtility.SizeOf <TextVertex>(), ref num);
            NativeArray <TextVertex> nativeArray = new NativeArray <TextVertex>(num, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
            bool flag = num > 0;

            if (flag)
            {
                TextNative.GetVertices(settings, (IntPtr)nativeArray.GetUnsafePtr <TextVertex>(), UnsafeUtility.SizeOf <TextVertex>(), ref num);
                Debug.Assert(num == nativeArray.Length);
            }
            return(nativeArray);
        }
コード例 #8
0
        public static float ComputeTextHeight(TextNativeSettings settings)
        {
            if (settings.font == null)
            {
                Debug.LogError("Cannot process a null font.");
                return(0);
            }

            if (string.IsNullOrEmpty(settings.text))
            {
                return(0);
            }

            return(DoComputeTextHeight(settings));
        }
コード例 #9
0
        public static Vector2 GetCursorPosition(TextNativeSettings settings, Rect rect, int cursorIndex)
        {
            bool    flag = settings.font == null;
            Vector2 result;

            if (flag)
            {
                Debug.LogError("Cannot process a null font.");
                result = Vector2.zero;
            }
            else
            {
                result = TextNative.DoGetCursorPosition(settings, rect, cursorIndex);
            }
            return(result);
        }
コード例 #10
0
        public static Vector2 GetOffset(TextNativeSettings settings, Rect screenRect)
        {
            bool    flag = settings.font == null;
            Vector2 result;

            if (flag)
            {
                Debug.LogError("Cannot process a null font.");
                result = new Vector2(0f, 0f);
            }
            else
            {
                settings.text = (settings.text ?? "");
                result        = TextNative.DoGetOffset(settings, screenRect);
            }
            return(result);
        }
コード例 #11
0
            internal static TextNativeSettings GetTextNativeSettings(MeshGenerationContextUtils.TextParams textParams, float scaling)
            {
                TextNativeSettings result = new TextNativeSettings
                {
                    text          = textParams.text,
                    font          = textParams.font,
                    size          = textParams.fontSize,
                    scaling       = scaling,
                    style         = textParams.fontStyle,
                    color         = textParams.fontColor,
                    anchor        = textParams.anchor,
                    wordWrap      = textParams.wordWrap,
                    wordWrapWidth = textParams.wordWrapWidth,
                    richText      = textParams.richText
                };

                result.color *= textParams.playmodeTintColor;
                return(result);
            }
コード例 #12
0
            internal static TextNativeSettings GetTextNativeSettings(TextParams textParams, float scaling)
            {
                var settings = new TextNativeSettings
                {
                    text          = textParams.text,
                    font          = textParams.font,
                    size          = textParams.fontSize,
                    scaling       = scaling,
                    style         = textParams.fontStyle,
                    color         = textParams.fontColor,
                    anchor        = textParams.anchor,
                    wordWrap      = textParams.wordWrap,
                    wordWrapWidth = textParams.wordWrapWidth,
                    richText      = textParams.richText
                };

                settings.color *= textParams.playmodeTintColor;

                return(settings);
            }
コード例 #13
0
        public static float ComputeTextHeight(TextNativeSettings settings)
        {
            bool  flag = settings.font == null;
            float result;

            if (flag)
            {
                Debug.LogError("Cannot process a null font.");
                result = 0f;
            }
            else
            {
                bool flag2 = string.IsNullOrEmpty(settings.text);
                if (flag2)
                {
                    result = 0f;
                }
                else
                {
                    result = TextNative.DoComputeTextHeight(settings);
                }
            }
            return(result);
        }
コード例 #14
0
 private static extern float DoComputeTextHeight_Injected(ref TextNativeSettings settings);
コード例 #15
0
 private static extern void DoGetOffset_Injected(ref TextNativeSettings settings, ref Rect rect, out Vector2 ret);
コード例 #16
0
 private static float DoComputeTextHeight(TextNativeSettings settings)
 {
     return(TextNative.DoComputeTextHeight_Injected(ref settings));
 }
コード例 #17
0
 private static extern Vector2 DoGetOffset(TextNativeSettings settings, Rect rect);
コード例 #18
0
 private static extern void GetVertices(TextNativeSettings settings, IntPtr buffer, int vertexSize, ref int vertexCount);
コード例 #19
0
 private static extern Vector2 DoGetCursorPosition(TextNativeSettings settings, Rect rect, int cursorPosition);
コード例 #20
0
 private static extern float DoComputeTextHeight(TextNativeSettings settings);
コード例 #21
0
 private static extern float DoComputeTextWidth(TextNativeSettings settings);
コード例 #22
0
 private static extern void DoGetCursorPosition_Injected(ref TextNativeSettings settings, ref Rect rect, int cursorPosition, out Vector2 ret);
コード例 #23
0
 private static void GetVertices(TextNativeSettings settings, IntPtr buffer, int vertexSize, ref int vertexCount)
 {
     TextNative.GetVertices_Injected(ref settings, buffer, vertexSize, ref vertexCount);
 }
コード例 #24
0
 private static float DoComputeTextWidth(TextNativeSettings settings)
 {
     return(TextNative.DoComputeTextWidth_Injected(ref settings));
 }