Esempio n. 1
0
        static int _m_GetGenerationSettings(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.UI.Text gen_to_be_invoked = (UnityEngine.UI.Text)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.Vector2 _extents; translator.Get(L, 2, out _extents);

                    UnityEngine.TextGenerationSettings gen_ret = gen_to_be_invoked.GetGenerationSettings(
                        _extents);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 2
0
        static StackObject *GetGenerationSettings_31(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Vector2 @extents = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.UI.Text instance_of_this_method = (UnityEngine.UI.Text) typeof(UnityEngine.UI.Text).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetGenerationSettings(@extents);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 3
0
        int UnityEngineUIText_m_GetGenerationSettings(RealStatePtr L, int gen_param_count)
        {
            ObjectTranslator translator = this;


            UnityEngine.UI.Text gen_to_be_invoked = (UnityEngine.UI.Text)translator.FastGetCSObj(L, 1);


            {
                UnityEngine.Vector2 _extents; translator.Get(L, 2, out _extents);

                UnityEngine.TextGenerationSettings gen_ret = gen_to_be_invoked.GetGenerationSettings(_extents);
                translator.Push(L, gen_ret);



                return(1);
            }
        }
        public static float GetLineHeight(this UnityEngine.UI.Text text)
        {
            var extents    = text.cachedTextGenerator.rectExtents.size * 0.5f;
            var lineHeight = text.cachedTextGeneratorForLayout.GetPreferredHeight("A", text.GetGenerationSettings(extents));

            return(lineHeight);
        }
Esempio n. 5
0
        public static void forceRedraw(this UnityEngine.UI.Text text, string str)
        {
            var rt = text.transform as RectTransform;

            text.cachedTextGenerator.Populate(str, text.GetGenerationSettings(rt.rect.size));
        }
            public void Create(PxPre.FileBrowse.FileBrowseProp prop, FileBrowser browser)
            {
                this.prop    = prop;
                this.browser = browser;

                GameObject goLabel = new GameObject("FontLabel");

                goLabel.transform.SetParent(this.transform);
                goLabel.transform.localScale    = Vector3.one;
                goLabel.transform.localRotation = Quaternion.identity;
                UnityEngine.UI.Text txtLabel = goLabel.AddComponent <UnityEngine.UI.Text>();
                this.prop.inputLabel.Apply(txtLabel);
                txtLabel.horizontalOverflow = HorizontalWrapMode.Overflow;
                txtLabel.verticalOverflow   = VerticalWrapMode.Overflow;
                txtLabel.alignment          = TextAnchor.MiddleLeft;
                txtLabel.text = "Filename";
                RectTransform          rtLabel  = txtLabel.rectTransform;
                TextGenerationSettings tgsLabel = txtLabel.GetGenerationSettings(new Vector2(float.PositiveInfinity, float.PositiveInfinity));

                tgsLabel.scaleFactor = 1.0f;
                TextGenerator tgLabel    = txtLabel.cachedTextGenerator;
                float         labelWidth = tgLabel.GetPreferredWidth(txtLabel.text, tgsLabel);

                rtLabel.pivot     = new Vector2(0.0f, 0.5f);
                rtLabel.anchorMin = new Vector2(0.0f, 0.0f);
                rtLabel.anchorMax = new Vector2(0.0f, 1.0f);
                rtLabel.offsetMin = new Vector2(0.0f, 0.0f);
                rtLabel.offsetMax = new Vector2(labelWidth, 0.0f);

                GameObject goInput = new GameObject("Input");

                goInput.transform.SetParent(this.transform);
                goInput.transform.localScale    = Vector3.one;
                goInput.transform.localRotation = Quaternion.identity;
                UnityEngine.UI.Image imgInput = goInput.AddComponent <UnityEngine.UI.Image>();
                imgInput.type   = UnityEngine.UI.Image.Type.Sliced;
                imgInput.sprite = this.prop.inputPlateSprite;
                RectTransform rtInput = imgInput.rectTransform;

                rtInput.anchorMin = Vector2.zero;
                rtInput.anchorMax = Vector2.one;
                rtInput.offsetMin = new Vector2(labelWidth + this.prop.inputLabelInputPadding, 0.0f);
                rtInput.offsetMax = Vector2.zero;

                GameObject goInputText = new GameObject("InputText");

                goInputText.transform.SetParent(goInput.transform);
                goInputText.transform.localScale    = Vector3.one;
                goInputText.transform.localRotation = Quaternion.identity;
                UnityEngine.UI.Text textInput = goInputText.AddComponent <UnityEngine.UI.Text>();
                this.prop.inputText.Apply(textInput);
                textInput.alignment        = TextAnchor.MiddleLeft;
                textInput.verticalOverflow = VerticalWrapMode.Overflow;
                RectTransform rtText = textInput.rectTransform;

                rtText.anchorMin = Vector2.zero;
                rtText.anchorMax = Vector2.one;
                rtText.pivot     = new Vector2(0.0f, 0.5f);
                rtText.offsetMin = new Vector2(this.prop.inputPadding, 0.0f);
                rtText.offsetMax = new Vector2(-this.prop.inputPadding, 0.0f);

                this.input = goInput.AddComponent <UnityEngine.UI.InputField>();
                this.input.textComponent    = textInput;
                this.input.onValidateInput += this.OnValidateInput;
                this.input.lineType         = UnityEngine.UI.InputField.LineType.MultiLineNewline;
            }