Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayAssetDelivery event dispatch results in multiple status reports across different asset packs on each change #19

Open
ajwfrost opened this issue Jan 17, 2024 · 0 comments

Comments

@ajwfrost
Copy link
Contributor

From #18 ...


The PlayAssetDeliveryEvent events are also somehow heretic... I wanted first fetch the fast-follow assets and then fetch the on-demand assets... it goes ok with the first pack, but when I call assets.fetchAssetPack("asset_pack3"); when I receive PlayAssetStatus.COMPLETED then I receive the COMPLETED event for the fast pack with each on-demand pack event. It looks that the closed source is maybe reporting status for all packs with every internal change. But that should be maybe as a separate issue.

My code looks like:

case PlayAssetStatus.COMPLETED:
{
	if(event.assetPackName == "asset_pack2") {
		log("status asset_pack2: "+ assets.getAssetPackStatus("asset_pack2")); // always zero!!!
		log("absolutePath: "+ assets.getAssetAbsolutePath("asset_pack2", "Start.lvl")); // OK

		// we have the fast follow assets, so let's download the rest!
		log("\non-demand assets =====================================");
		assets.fetchAssetPack("asset_pack3");
	} else {
		log("status asset_pack3: "+ assets.getAssetPackStatus("asset_pack3"));  // always zero!!!
		log(assets.getAssetAbsolutePath("asset_pack3", "Univerzal.lvl"));  // OK
		
		// stop resolving any other events as we are done!
		assets.removeEventListener( PlayAssetDeliveryEvent.PLAY_ASSET_UPDATE, playAssetDelivery_statusHandler );
	}
	break;
}

Probably an issue with event handling given the recent re-architecture away from using a singleton within the SWC...


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant