That’s what AssetsManagerTest looks like.
>
So developers, not cocos2d-x have to do the threading, what we want is:
cocos2d-x do the threading, games just get callback, like CCHttpClient
user can cancel downloading anytime
>
will you guys consider doing these?
1:you can use CCDirector::sharedDirector()->getScheduler()->scheduleSelector to do callback to notify the main thread .2:you can use close of curl to cancel downloading
BTW, the AssetsManagerTest is not so stable , if you click enter button 2 times, it will crash, maybe they don’t have enough time to test it , but it’s just a guiding for me.
Yep, AssetsManager will support downloading in a new thread later.
There are two ways to do it
* Change update(), make it download resources in a new thread.
* Add a new method, such as updateAsync(), to download resources in a new thread.
Which is better?
Of course, AssetsManager should add a method to stop downloading.
should we add an error callback of downloading?
OK, I hope it more useful :
1.support pause, resume , cancel downloading.
2.continue from last downloading.
Yep, AssetsManager will support downloading in a new thread later.
There are two ways to do it
* Change update(), make it download resources in a new thread.
* Add a new method, such as updateAsync(), to download resources in a new thread.
>
Which is better?
>
Of course, AssetsManager should add a method to stop downloading.
>
Thank you for your feedback.
option2,adding updateAsync() method, so that AssetsManager can do both sync and async downloading? it may not be a good thing to have too many options.
plus, it needs a lot more effort to document it, as i can see you guys are very good coders, not very good at documenting,
i prefer option1, “* Change update(), make it download resources in a new thread.” and dispatch message to my main thread(getting call back) for:
progress, so that i can modify my progress bar
errors, sometimes games are Forbidden to download new versions to continue.
About errors, i think i can invoke a delegate when there is an error, but i think it is impossible to return error type,
because there are so many types of errors.
What’s your opinion?
C ZhangsKy wAr
>
Thank you for your suggestion.
>
About errors, i think i can invoke a delegate when there is an error, but i think it is impossible to return error type,
because there are so many types of errors.
What’s your opinion?
Exactly , I just care two errors : net and I/O errors , so I think it will be more useful if we can return the two error types at current version.
in the future , we can add more error types if someone wants to improve it.
Using the curl_multi_init to create a non-blocking’s http request, through the the update function gradually the download is complete, to return to the: Success, failure, in the downloading