Пример #1
0
    /// <summary>
    /// 设置材质的属性
    /// <para>spriteEffect</para>
    /// <para>propertyName 属性名称</para>
    /// <para>value 属性颜色值(16进制) 分别对应argb</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int SpriteEffectSetMatColor(ILuaState luaState)
    {
        STGSpriteEffect effect       = luaState.ToUserData(-3) as STGSpriteEffect;
        string          propertyName = luaState.ToString(-2);
        int             value        = luaState.ToInteger(-1);
        int             b            = value & 0xff;

        value >>= 8;
        int g = value & 0xff;

        value >>= 8;
        int r = value & 0xff;

        value >>= 8;
        int a = value;

        effect.SetMatColor(propertyName, new Color(r / 256f, g / 256f, b / 256f, a / 256f));
        return(0);
    }