huey

我希望spine-web-player在切换资源播放时不需要去加载新资源,而是在一开始初始化时加载全部的资源,如果可以的话应该怎么写呢
huey
  • Сообщения: 6

Mario

抱歉,我使用的翻译引擎不是很好。 您能否更详细地解释一下,您的问题是什么以及您要达到的目标是什么?
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

Mario
  • Сообщения: 3079

huey

Mario писал(а):抱歉,我使用的翻译引擎不是很好。 您能否更详细地解释一下,您的问题是什么以及您要达到的目标是什么?
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
huey
  • Сообщения: 6

Mario

Аватара пользователя
Mario

Mario
  • Сообщения: 3079

huey

Mario писал(а):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
uh.Do you have an example of how to override "Downloader"
huey
  • Сообщения: 6

Mario

You don't even necessarily need to override Downloader. You could just do the following:

1. Preload all asset files (.json/.skel, .altas, .png) however you want and convert them to data URIs.
2. Instantiate a Downloader and fill the rawDataURIs map (file path > data uri) https://github.com/EsotericSoftware/spine-runtimes/blob/e39f74837a615e32e97ffac3b89eb692e3783ad6/spine-ts/spine-core/src/AssetManagerBase.ts#L244
3. Set the Downloader on the SpinePlayerConfig 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.
Аватара пользователя
Mario

Mario
  • Сообщения: 3079


Вернуться в 中国Spine用户