我希望spine-web-player在切换资源播放时不需要去加载新资源,而是在一开始初始化时加载全部的资源,如果可以的话应该怎么写呢
spine-web-player是否可以同时加载多个资源
- Modifié
抱歉,我使用的翻译引擎不是很好。 您能否更详细地解释一下,您的问题是什么以及您要达到的目标是什么?
Sorry, the translation engine I use is not very good. Could you please explain in more detail, what your problem is and what you are trying to achieve?
Mario a écrit抱歉,我使用的翻译引擎不是很好。 您能否更详细地解释一下,您的问题是什么以及您要达到的目标是什么?
Sorry, the translation engine I use is not very good. Could you please explain in more detail, what your problem is and what you are trying to achieve?
I want spin-web-player to not need to load new resources when switching resources to play, but to load all resources at initial initialization. How should I write it if it can
How are you switching resources with Spine Player? You can pass a custom Downloader
to the Spine player that preloads all the resources the player needs:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-player/src/Player.ts#L166
https://github.com/EsotericSoftware/spine-runtimes/blob/e39f74837a615e32e97ffac3b89eb692e3783ad6/spine-ts/spine-core/src/AssetManagerBase.ts#L242
Mario a écritHow are you switching resources with Spine Player? You can pass a custom
Downloader
to the Spine player that preloads all the resources the player needs:https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-player/src/Player.ts#L166
https://github.com/EsotericSoftware/spine-runtimes/blob/e39f74837a615e32e97ffac3b89eb692e3783ad6/spine-ts/spine-core/src/AssetManagerBase.ts#L242
uh.Do you have an example of how to override "Downloader"
You don't even necessarily need to override Downloader. You could just do the following:
- Preload all asset files (.json/.skel, .altas, .png) however you want and convert them to data URIs.
- Instantiate a
Downloader
and fill therawDataURIs
map (file path > data uri) https://github.com/EsotericSoftware/spine-runtimes/blob/e39f74837a615e32e97ffac3b89eb692e3783ad6/spine-ts/spine-core/src/AssetManagerBase.ts#L244 - Set the
Downloader
on theSpinePlayerConfig
and create the web player.
Everytime you then tell the webplayer to reload assets with specific paths, it will ask the Downloader
which will return thek from its rawDataURIS
map.