airsdk / ANE-PlayAssetDelivery

Play Asset Delivery ANE
2 stars 2 forks source link

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

Open ajwfrost opened 5 months ago

ajwfrost commented 5 months ago

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...

------