Code Monkey home page Code Monkey logo

resourcemanager's People

Contributors

chengxu1973 avatar laixiao avatar wanderwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

resourcemanager's Issues

低版本 nodejs 运行 res 有可能报错

如果用户的 node 版本较低,会报以下错误


AppData\Roaming\npm\node_modules\egret-resource-manager\script\out\cli.js:3
const res = require("./");
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

相关链接:

使用 ResourceManager 发布资源遇到问题

使用 ResourceManager 发布html5资源,遇到问题如下:
1、按照publish.md文档步骤,发不完之后,config文件都被加了后缀,这个和RES.loadConfig() 不再接受参数,强制访问 resource/config.json 文件冲突
2、手动把第一步的config后缀去掉后,又遇到第二个,在default.thm.json中的skin和exmls,发布之后并不会被自动修改后缀,这就导致在加载这个主题文件时,提示里面的各种小皮肤找不到。

请问以上两个问题是否可解?或者有没有其他办法可以使用ResourceManager发布资源支持crc32

resourcemanager升级的必要性?

比较老版的RES,新的resourcemagnager就是添加了promise语法支持,性能上并无优势?
除了通过res build 引入旧有default.res.json 的 group以外,有什么办法独立自动生成config.json里的group?只能依赖过去的系统的话,这个方案是不是太过简陋了。。
官方会完全废弃原本的RES吗?预计是什么时候?

架构设计:资源管理的 core 模块与 shim 模块

资源管理模块包含 core (内核)和 shim (兼容层)两层结构,core模块包含以下一组 API

R.load: (url:string)=>Promise<any>
R.unload: (url:string)=>Promise<void>

在未来,开发者只需直接使用 core 内核的 API 即可,但是在短期内,考虑到 core 模块的 API 可能会出现较大幅度的变化,目前只开放 shim 模块的 API,即 RES.loadGroup 等老式 API

以下功能不属于内核:

  • 资源组
  • 资源别名

这些功能将被作为一个 shim 模块,用于老项目进行迁移和向下兼容

Processor 应该是一个 class 而不是简单的 Object

自定义处理器

这种自定义的方法,远远不如原本的 Analyzer
原本 Analyzer 可以实现 继承后 override 特点方法,现在的 processor 只是 Res.processor.map 里的一个 Object,不能做到继承。

毕竟是 Typescript 的 项目,class 继承 这种基本的功能 还是应该实现的。

resource的demo项目都跑不通

E:\workspace\html5\test\resourceTest\resourceTest>res build
C:\Users\xy\AppData\Roaming\npm\node_modules\egret-resource-manager\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\node_modules\inflight\inflight.js:39
RES.apply(null, args)
^

ReferenceError: RES is not defined
at C:\Users\xy\AppData\Roaming\npm\node_modules\egret-resource-manager\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\node_modules\inflight\inflight.js:39:11
at doNTCallback0 (node.js:419:9)
at process._tickCallback (node.js:348:13)

版本控制支持

允许开发者将资源按照 crc32 编码格式进行发布,以实现版本控制与热更新功能

支持 npm 2.x

如果使用 npm 2.x 版本,执行 res 会报错 Could not found module 'fs-extra-promise'

ResourceManager 和 EUI 使用纹理合并后存在冲突

这个问题可能由多方面原因导致

  • 老项目如果 RES.mapConfig 的 TypeSelector 判断错误,就会导致纹理加载失败 #19
  • 如果在 Egret Wing 中直接拖拽一个合图后的纹理,无法正确显示,需要把 key 中的 . 修改为 #

问题2会在未来的 Egret Wing 中进行解决,目前开发者可以手动修改项目中的 AssetAdapter ,将外部传递的 . 替换为 #

RES.getResByUrl不支持await

看了下源码,实际上RES.Resource.getResByUrl返回的已经是一个Promise对象了,为什么在RES.getResByUrl中不返回Promise对象,而是void?

并且RES.instance没有对外开放,如果想用await写法,就只能进行如下操作:
await new RES.Resource().getResByUrl(source, null, this, RES.ResourceItem.TYPE_IMAGE);

这样设计的目的是什么呢?这个新模块不就是为了ES2015而生的么?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.