mirror of https://github.com/axmolengine/axmol.git
style edited
This commit is contained in:
parent
d202a6fa24
commit
200a1ec831
|
@ -654,6 +654,7 @@ AssetsManager* AssetsManager::create(const char* packageUrl, const char* version
|
|||
auto* delegate = new DelegateProtocolImpl(errorCallback,progressCallback,successCallback);
|
||||
manager->setDelegate(delegate);
|
||||
manager->_shouldDeleteDelegateWhenExit = true;
|
||||
manager->autorelease();
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,6 @@ UpdateLayer::UpdateLayer()
|
|||
|
||||
UpdateLayer::~UpdateLayer()
|
||||
{
|
||||
AssetsManager *pAssetsManager = getAssetsManager();
|
||||
CC_SAFE_DELETE(pAssetsManager);
|
||||
}
|
||||
|
||||
void UpdateLayer::update(cocos2d::Object *pSender)
|
||||
|
@ -141,6 +139,14 @@ bool UpdateLayer::init()
|
|||
{
|
||||
Layer::init();
|
||||
|
||||
/** Creates assets manager */
|
||||
pAssetsManager = new AssetsManager("https://raw.github.com/minggo/AssetsManagerTest/master/package.zip",
|
||||
"https://raw.github.com/minggo/AssetsManagerTest/master/version",
|
||||
pathToSave.c_str());
|
||||
pAssetsManager->setDelegate(this);
|
||||
pAssetsManager->setConnectionTimeout(3);
|
||||
addChild(pAssetsManager);
|
||||
|
||||
createDownloadedDir();
|
||||
|
||||
Size size = Director::getInstance()->getWinSize();
|
||||
|
@ -164,22 +170,6 @@ bool UpdateLayer::init()
|
|||
return true;
|
||||
}
|
||||
|
||||
AssetsManager* UpdateLayer::getAssetsManager()
|
||||
{
|
||||
static AssetsManager *pAssetsManager = NULL;
|
||||
|
||||
if (! pAssetsManager)
|
||||
{
|
||||
pAssetsManager = new AssetsManager("https://raw.github.com/minggo/AssetsManagerTest/master/package.zip",
|
||||
"https://raw.github.com/minggo/AssetsManagerTest/master/version",
|
||||
pathToSave.c_str());
|
||||
pAssetsManager->setDelegate(this);
|
||||
pAssetsManager->setConnectionTimeout(3);
|
||||
}
|
||||
|
||||
return pAssetsManager;
|
||||
}
|
||||
|
||||
void UpdateLayer::createDownloadedDir()
|
||||
{
|
||||
pathToSave = FileUtils::getInstance()->getWritablePath();
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual void onSuccess();
|
||||
|
||||
private:
|
||||
cocos2d::extension::AssetsManager* getAssetsManager();
|
||||
cocos2d::extension::AssetsManager* pAssetsManager;
|
||||
void createDownloadedDir();
|
||||
|
||||
cocos2d::MenuItemFont *pItemEnter;
|
||||
|
|
Loading…
Reference in New Issue