示例#1
0
        /** CreateUiInputField
         */
        public static UnityEngine.GameObject CreateUiInputField(string a_name, UnityEngine.Transform a_parent_transform)
        {
            UnityEngine.UI.DefaultControls.Resources t_resources = new UnityEngine.UI.DefaultControls.Resources();
            {
                t_resources.inputField = Instantiate.GetInstance().inputfield_sprite;;
            }

            UnityEngine.GameObject t_gameobject = UnityEngine.UI.DefaultControls.CreateInputField(t_resources);
            if (t_gameobject != null)
            {
                //name
                t_gameobject.name = a_name;

                //parent
                t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform);

                //image
                UnityEngine.UI.Image t_image = t_gameobject.GetComponent <UnityEngine.UI.Image>();
                {
                    t_image.type = UnityEngine.UI.Image.Type.Sliced;
                }
            }
            else
            {
                Tool.Assert(false);
            }

            return(t_gameobject);
        }
示例#2
0
        static StackObject *CreateText_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.UI.DefaultControls.Resources resources = (UnityEngine.UI.DefaultControls.Resources) typeof(UnityEngine.UI.DefaultControls.Resources).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = UnityEngine.UI.DefaultControls.CreateText(resources);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
示例#3
0
        /** CreateUiInputField
         */
        public static UnityEngine.GameObject CreateUiInputField(string a_name, UnityEngine.Transform a_parent_transform)
        {
            UnityEngine.UI.DefaultControls.Resources t_resources = new UnityEngine.UI.DefaultControls.Resources();
            {
                //テクスチャー読み込み。
                {
                    if (s_inputfield_sprite == null)
                    {
                        UnityEngine.Texture2D t_texture = UnityEngine.Resources.Load <UnityEngine.Texture2D>(Config.TEXTURE_NAME_INPUTFIELD);
                        UnityEngine.Rect      t_rect    = new UnityEngine.Rect(0.0f, 0.0f, t_texture.width, t_texture.height);
                        UnityEngine.Vector2   t_pivot   = new UnityEngine.Vector2(t_texture.width / 2, t_texture.height / 2);
                        float t_pixels_per_unit         = 100.0f;
                        uint  t_extrude = 1;
                        UnityEngine.SpriteMeshType t_mesh_type = UnityEngine.SpriteMeshType.FullRect;
                        UnityEngine.Vector4        t_border    = new UnityEngine.Vector4(4.0f, 4.0f, 4.0f, 4.0f);
                        bool t_generate_fallback_physicsshape  = true;

                        s_inputfield_sprite = UnityEngine.Sprite.Create(t_texture, t_rect, t_pivot, t_pixels_per_unit, t_extrude, t_mesh_type, t_border, t_generate_fallback_physicsshape);
                    }
                }

                t_resources.inputField = s_inputfield_sprite;
            }

            UnityEngine.GameObject t_gameobject = UnityEngine.UI.DefaultControls.CreateInputField(t_resources);
            if (t_gameobject != null)
            {
                //name
                t_gameobject.name = a_name;

                //parent
                t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform);

                //image
                UnityEngine.UI.Image t_image = t_gameobject.GetComponent <UnityEngine.UI.Image>();
                {
                    t_image.type = UnityEngine.UI.Image.Type.Sliced;
                }
            }
            else
            {
                Tool.Assert(false);
            }

            return(t_gameobject);
        }
        public static GameObject CreateTable(UnityEngine.UI.DefaultControls.Resources resources)
        {
            GameObject buttonRoot = CreateUIElementRoot("Table", s_ThickElementSize);

            HorizontalLayoutGroup layoutGroup = buttonRoot.AddComponent <HorizontalLayoutGroup>();

            layoutGroup.childControlWidth = layoutGroup.childControlHeight = layoutGroup.childForceExpandWidth = layoutGroup.childForceExpandHeight = true;
            layoutGroup.spacing           = -1f;

            ContentSizeFitter sizeFitter = buttonRoot.AddComponent <ContentSizeFitter>();

            sizeFitter.horizontalFit = sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;

            buttonRoot.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 1f);

            buttonRoot.AddComponent <Table>();

            return(buttonRoot);
        }
示例#5
0
        /** CreateUiText
         */
        public static UnityEngine.GameObject CreateUiText(string a_name, UnityEngine.Transform a_parent_transform)
        {
            UnityEngine.UI.DefaultControls.Resources t_resources = new UnityEngine.UI.DefaultControls.Resources();
            {
            }

            UnityEngine.GameObject t_gameobject = UnityEngine.UI.DefaultControls.CreateText(t_resources);
            if (t_gameobject != null)
            {
                //name
                t_gameobject.name = a_name;

                //parent
                t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform);

                //outline
                UnityEngine.UI.Outline t_outline = t_gameobject.AddComponent <UnityEngine.UI.Outline>();
                {
                    t_outline.useGraphicAlpha = true;
                    t_outline.effectColor     = UnityEngine.Color.black;
                    t_outline.effectDistance  = new UnityEngine.Vector2(1.0f, -1.0f);
                }

                //shadow
                UnityEngine.UI.Shadow t_shadow = t_gameobject.AddComponent <UnityEngine.UI.Shadow>();
                {
                    t_shadow.useGraphicAlpha = true;
                    t_outline.effectColor    = UnityEngine.Color.black;
                    t_outline.effectDistance = new UnityEngine.Vector2(1.0f, -1.0f);
                }
            }
            else
            {
                Tool.Assert(false);
            }

            return(t_gameobject);
        }