Ejemplo n.º 1
0
    /// <summary>
    /// 设置颜色
    /// </summary>
    /// <param name="state"></param>
    public void SetStatus(UISpriteState state)
    {
        if (_image == null)
        {
            _image = gameObject.GetComponent <Image>();
            if (_image == null)
            {
                Debugger.LogError("UISpriteSwap need Image Component");
            }
        }

        switch (state)
        {
        case UISpriteState.Normal:
            if (DisableColor != null)
            {
                _image.color = NormalColor;
            }
            break;

        case UISpriteState.HighLighted:
            if (DisableColor != null)
            {
                _image.color = HighLightedColor;
            }
            break;

        case UISpriteState.Disable:
            if (DisableColor != null)
            {
                _image.color = DisableColor;
            }
            break;
        }
    }
Ejemplo n.º 2
0
    static int IntToEnum(IntPtr L)
    {
        int           arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        UISpriteState o    = (UISpriteState)arg0;

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Ejemplo n.º 3
0
    static int SetSprite(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UISpriteChange obj  = LuaScriptMgr.GetUnityObject <UISpriteChange>(L, 1);
        UISpriteState  arg0 = LuaScriptMgr.GetNetObject <UISpriteState>(L, 2);

        obj.SetSprite(arg0);
        return(0);
    }
Ejemplo n.º 4
0
    //void Start () {


    //}
    public void SetSprite(UISpriteState state)
    {
        if (_image == null)
        {
            _image = gameObject.GetComponent <Image>();
            if (_image == null)
            {
                Debugger.LogError("UISpriteSwap need Image Component");
            }
        }
        switch (state)
        {
        case UISpriteState.Normal:
            if (NormalSprite != null)
            {
                _image.sprite = NormalSprite;
            }
            break;

        case UISpriteState.HighLighted:
            if (HighLightedSprite != null)
            {
                _image.sprite = HighLightedSprite;
            }
            break;

        case UISpriteState.Press:
            if (PressSprite != null)
            {
                _image.sprite = PressSprite;
            }
            break;

        case UISpriteState.Disable:
            if (DisableSprite != null)
            {
                _image.sprite = DisableSprite;
            }
            break;
        }
    }