eva-engine / eva.js

Eva.js is a front-end game engine specifically for creating interactive game projects.
https://eva.js.org
MIT License
1.75k stars 108 forks source link

RESOURCE_TYPE 大小写兼容 #5

Closed lidongjies closed 3 years ago

lidongjies commented 3 years ago

Expected Behavior

希望资源类型可以兼容大小写

Current Behavior

目前只支持 RESOURCE_TYPE.IMAGE 枚举值,也就是大写的 ‘IMAGE’ 字符串

resource.addResource([
    {
        name: 'imageName',
        type: RESOURCE_TYPE.IMAGE,
        src: {
            image: {
                type: 'png',
                url: 'https://gw.alicdn.com/tfs/TB1DNzoOvb2gK0jSZK9XXaEgFXa-658-1152.webp',
            },
        },
        preload: true,
    },
]);
fanmingfei commented 3 years ago

这里 type 需要支持非 RESOUCE_TYPE 的字符串,因为在第三方插件中可以实现更多的资源类型。

fanmingfei commented 3 years ago

我认为这个功能没有特别大的必要,先关闭吧。