Esempio n. 1
0
        GOGUI.LazyLoadImage MakeLazyLoadImage(UnityEngine.UI.Image img, string path)
        {
            GameObject go    = img.gameObject;
            Color      color = img.color;
            Material   mat   = img.material;
            bool       rt    = img.raycastTarget;
            bool       pa    = img.preserveAspect;

            UnityEngine.UI.Image.Type type = img.type;
            bool  clockwise = img.fillClockwise;
            bool  fc        = img.fillCenter;
            float fa        = img.fillAmount;

            UnityEngine.UI.Image.FillMethod fm = img.fillMethod;
            int fo = img.fillOrigin;

            GameObject.DestroyImmediate(img);

            GOGUI.LazyLoadImage li = go.AddComponent <GOGUI.LazyLoadImage>();
            li.SpriteName     = path;
            li.color          = color;
            li.material       = mat;
            li.raycastTarget  = rt;
            li.type           = type;
            li.preserveAspect = pa;
            li.fillClockwise  = clockwise;
            li.fillCenter     = fc;
            li.fillAmount     = fa;
            li.fillMethod     = fm;
            li.fillOrigin     = fo;

            return(li);
        }
Esempio n. 2
0
 public EleGenToggle(
     EleBaseRect parent,
     TextAttrib textAttrib,
     string text,
     SelectableInfo plateStyle,
     float toggleWidth,
     Sprite toggleSprite,
     UnityEngine.UI.Image.Type icoType,
     PadRect togglePad,
     Vector2 size,
     float separation = 0.0f,
     string name      = "")
     : base(parent, size, name)
 {
     this._Create(
         parent,
         textAttrib,
         text,
         plateStyle,
         toggleWidth,
         toggleSprite,
         icoType,
         togglePad,
         size,
         separation,
         name);
 }
Esempio n. 3
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        UnityEngine.UI.Image.Type o = (UnityEngine.UI.Image.Type)arg0;
        ToLua.Push(L, o);
        return(1);
    }
Esempio n. 4
0
    static int QPYX_set_type_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.UI.Image QPYX_obj_YXQP = (UnityEngine.UI.Image)QPYX_o_YXQP;
            UnityEngine.UI.Image.Type QPYX_arg0_YXQP = (UnityEngine.UI.Image.Type)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.UI.Image.Type));
            QPYX_obj_YXQP.type = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index type on a nil value"));
        }
    }
    public ImageData(Image image)
    {
        sourceImagePath = UnityEditor.AssetDatabase.GetAssetPath(image.sprite);
        //Debug.Log("Path of image:" + sourceImagePath);

        alphaHitTestMinimumThreshold = image.alphaHitTestMinimumThreshold;
        fillAmount     = image.fillAmount;
        fillCenter     = image.fillCenter;
        fillClockwise  = image.fillClockwise;
        fillMethod     = image.fillMethod;
        fillOrigin     = image.fillOrigin;
        preserveAspect = image.preserveAspect;
        type           = image.type;
        color          = image.color;
    }
Esempio n. 6
0
    static int QPYX_get_type_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.UI.Image QPYX_obj_YXQP = (UnityEngine.UI.Image)QPYX_o_YXQP;
            UnityEngine.UI.Image.Type QPYX_ret_YXQP = QPYX_obj_YXQP.type;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index type on a nil value"));
        }
    }
    static int set_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.Image      obj  = (UnityEngine.UI.Image)o;
            UnityEngine.UI.Image.Type arg0 = (UnityEngine.UI.Image.Type)LuaDLL.luaL_checknumber(L, 2);
            obj.type = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"));
        }
    }
    static int set_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.Image      obj  = (UnityEngine.UI.Image)o;
            UnityEngine.UI.Image.Type arg0 = (UnityEngine.UI.Image.Type)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.Image.Type));
            obj.type = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index type on a nil value" : e.Message));
        }
    }
    static int get_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.Image      obj = (UnityEngine.UI.Image)o;
            UnityEngine.UI.Image.Type ret = obj.type;
            LuaDLL.lua_pushinteger(L, (int)ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"));
        }
    }
    static int get_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.Image      obj = (UnityEngine.UI.Image)o;
            UnityEngine.UI.Image.Type ret = obj.type;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index type on a nil value" : e.Message));
        }
    }
Esempio n. 11
0
    public void InitializeImageComponent(string _imgName, UnityEngine.UI.Image.Type _imgType)
    {
        if (string.IsNullOrEmpty(_imgName))
        {
            return;
        }

        Image = GameObject.GetComponent <UnityEngine.UI.Image>();
        if (Image == null)
        {
            Image = GameObject.AddComponent <UnityEngine.UI.Image>();
        }

        Sprite sprite = Resources.Load <Sprite>(_imgName);

        Image.type   = _imgType;
        Image.sprite = sprite;
    }
Esempio n. 12
0
        static StackObject *set_type_6(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.UI.Image.Type @value = (UnityEngine.UI.Image.Type) typeof(UnityEngine.UI.Image.Type).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.Image instance_of_this_method = (UnityEngine.UI.Image) typeof(UnityEngine.UI.Image).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.type = value;

            return(__ret);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            DrawAtlasPopupLayout(new GUIContent("Sprite Atlas"), new GUIContent("----"), m_SpriteAtlas);
            EditorGUI.indentLevel++;
            {
                DrawSpritePopup(m_SpriteAtlas.objectReferenceValue as SpriteAtlas, m_SpriteName);
            }
            EditorGUI.indentLevel--;

            AppearanceControlsGUI();
            RaycastControlsGUI();

            animShowType.target = m_SpriteAtlas.objectReferenceValue && !string.IsNullOrEmpty(m_SpriteName.stringValue);
            if (EditorGUILayout.BeginFadeGroup(animShowType.faded))
            {
                this.TypeGUI();
            }
            EditorGUILayout.EndFadeGroup();

            UIIMageType imageType = (UIIMageType)m_Type.intValue;

            base.SetShowNativeSize(imageType == UIIMageType.Simple || imageType == UIIMageType.Filled, false);

            if (EditorGUILayout.BeginFadeGroup(m_ShowNativeSize.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(m_PreserveAspect);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            base.NativeSizeButtonGUI();

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 14
0
        protected void DrawImageType()
        {
            UIIMageType imageType = (UIIMageType)m_Type.intValue;

            base.SetShowNativeSize(imageType == UIIMageType.Simple || imageType == UIIMageType.Filled, false);
        }
Esempio n. 15
0
 public static PxPre.UIL.EleImg Chn_SetImgType(this PxPre.UIL.EleImg img, UnityEngine.UI.Image.Type type)
 {
     img.Img.type = type;
     return(img);
 }
Esempio n. 16
0
        protected void _Create(
            EleBaseRect parent,
            TextAttrib textAttrib,
            string text,
            SelectableInfo plateStyle,
            float toggleWidth,
            Sprite toggleSprite,
            UnityEngine.UI.Image.Type icoType,
            PadRect togglePad,
            Vector2 size,
            float separation,
            string name)
        {
            this.minSize = size;

            this.separation  = separation;
            this.toggleWidth = toggleWidth;
            this.padding     = togglePad;

            GameObject go = new GameObject("Checkbox_" + name);

            go.transform.SetParent(parent.GetContentRect(), false);
            //
            this.plate      = go.AddComponent <UnityEngine.UI.Image>();
            this.plate.type = UnityEngine.UI.Image.Type.Sliced;
            this.plate.RTQ().TopLeftAnchorsPivot();
            //
            this.toggle = go.AddComponent <ty>();
            plateStyle.Apply(this.toggle, this.plate);

            GameObject goCheckmark = new GameObject("Checkmark_" + name);

            goCheckmark.transform.SetParent(go.transform, false);
            this.checkbox        = goCheckmark.AddComponent <UnityEngine.UI.Image>();
            this.checkbox.sprite = toggleSprite;
            this.checkbox.type   = icoType;

            if (icoType != UnityEngine.UI.Image.Type.Simple)
            {
                this.checkbox.
                RTQ().
                CenterPivot().
                ExpandParentFlush().
                OffsetMin(togglePad.left, togglePad.bot).
                OffsetMax(-togglePad.right, -togglePad.top);
            }
            else
            {
                this.checkbox.RTQ().
                CenterPivot().
                OffsetMin(0.5f, 0.5f).
                OffsetMax(0.5f, 0.5f).
                AnchPos(
                    (togglePad.left - togglePad.right) * 0.5f,
                    (togglePad.bot - togglePad.top) * 0.5f).
                SizeDelta(toggleSprite.rect.size);
            }

            if (textAttrib != null)
            {
                GameObject goText = new GameObject("Text_" + name);
                goText.transform.SetParent(go.transform, false);

                this.label      = goText.AddComponent <UnityEngine.UI.Text>();
                this.label.text = text;
                this.label.horizontalOverflow = HorizontalWrapMode.Overflow;
                this.label.verticalOverflow   = VerticalWrapMode.Overflow;
                this.label.alignment          = TextAnchor.LowerLeft;
                this.label.RTQ().Pivot(0.0f, 0.0f).BotLeftAnchors();
                textAttrib.Apply(this.label);
            }

            this.toggle.targetGraphic = this.plate;
            this.toggle.graphic       = this.checkbox;
        }
Esempio n. 17
0
 public static UnityEngine.UI.Image ImageType(this UnityEngine.UI.Image img, UnityEngine.UI.Image.Type type)
 {
     img.type = type;
     return(img);
 }
Esempio n. 18
0
 /// <summary>
 /// Apple the pair properties to an image and also set the image type.
 /// </summary>
 /// <param name="img">The image to apply to.</param>
 /// <param name="type">The image type to apply on the image.</param>
 public void Apply(UnityEngine.UI.Image img, UnityEngine.UI.Image.Type type)
 {
     this.Apply(img);
     img.type = type;
 }
Esempio n. 19
0
 static void Push(IntPtr L, UnityEngine.UI.Image.Type arg)
 {
     ToLua.Push(L, arg);
 }