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);
|
auto* delegate = new DelegateProtocolImpl(errorCallback,progressCallback,successCallback);
|
||||||
manager->setDelegate(delegate);
|
manager->setDelegate(delegate);
|
||||||
manager->_shouldDeleteDelegateWhenExit = true;
|
manager->_shouldDeleteDelegateWhenExit = true;
|
||||||
|
manager->autorelease();
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,6 @@ UpdateLayer::UpdateLayer()
|
||||||
|
|
||||||
UpdateLayer::~UpdateLayer()
|
UpdateLayer::~UpdateLayer()
|
||||||
{
|
{
|
||||||
AssetsManager *pAssetsManager = getAssetsManager();
|
|
||||||
CC_SAFE_DELETE(pAssetsManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateLayer::update(cocos2d::Object *pSender)
|
void UpdateLayer::update(cocos2d::Object *pSender)
|
||||||
|
@ -141,6 +139,14 @@ bool UpdateLayer::init()
|
||||||
{
|
{
|
||||||
Layer::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();
|
createDownloadedDir();
|
||||||
|
|
||||||
Size size = Director::getInstance()->getWinSize();
|
Size size = Director::getInstance()->getWinSize();
|
||||||
|
@ -164,22 +170,6 @@ bool UpdateLayer::init()
|
||||||
return true;
|
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()
|
void UpdateLayer::createDownloadedDir()
|
||||||
{
|
{
|
||||||
pathToSave = FileUtils::getInstance()->getWritablePath();
|
pathToSave = FileUtils::getInstance()->getWritablePath();
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
virtual void onSuccess();
|
virtual void onSuccess();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cocos2d::extension::AssetsManager* getAssetsManager();
|
cocos2d::extension::AssetsManager* pAssetsManager;
|
||||||
void createDownloadedDir();
|
void createDownloadedDir();
|
||||||
|
|
||||||
cocos2d::MenuItemFont *pItemEnter;
|
cocos2d::MenuItemFont *pItemEnter;
|
||||||
|
|
Loading…
Reference in New Issue