Add destroyCocosStudio()

This commit is contained in:
pipu 2015-03-30 16:46:33 +08:00
parent d437ce3e59
commit 6f20da4444
54 changed files with 137 additions and 39 deletions

View File

@ -218,6 +218,36 @@ void CSLoader::purge()
{
}
void CSLoader::destroyCocosStudio()
{
NodeReader::destroyInstance();
SingleNodeReader::destroyInstance();
SpriteReader::destroyInstance();
ParticleReader::destroyInstance();
ButtonReader::destroyInstance();
CheckBoxReader::destroyInstance();
ImageViewReader::destroyInstance();
TextBMFontReader::destroyInstance();
TextReader::destroyInstance();
TextFieldReader::destroyInstance();
TextAtlasReader::destroyInstance();
LoadingBarReader::destroyInstance();
SliderReader::destroyInstance();
LayoutReader::destroyInstance();
ScrollViewReader::destroyInstance();
PageViewReader::destroyInstance();
ListViewReader::destroyInstance();
ArmatureNodeReader::destroyInstance();
Node3DReader::destroyInstance();
Sprite3DReader::destroyInstance();
UserCameraReader::destroyInstance();
Particle3DReader::destroyInstance();
destroyInstance();
}
void CSLoader::init()
{
using namespace std::placeholders;

View File

@ -74,6 +74,8 @@ public:
CSLoader();
void purge();
static void destroyCocosStudio();
void init();
static cocos2d::Node* createNode(const std::string& filename);

View File

@ -111,7 +111,7 @@ FlatBuffersSerialize::FlatBuffersSerialize()
FlatBuffersSerialize::~FlatBuffersSerialize()
{
purge();
}
FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
@ -124,7 +124,7 @@ FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
return _instanceFlatBuffersSerialize;
}
void FlatBuffersSerialize::purge()
void FlatBuffersSerialize::destroyInstance()
{
CC_SAFE_DELETE(_instanceFlatBuffersSerialize);

View File

@ -91,7 +91,7 @@ class CC_STUDIO_DLL FlatBuffersSerialize
public:
static FlatBuffersSerialize* getInstance();
static void purge();
static void destroyInstance();
FlatBuffersSerialize();
~FlatBuffersSerialize();

View File

@ -34,6 +34,11 @@ ArmatureNodeReader* ArmatureNodeReader::getInstance()
return _instanceArmatureNodeReader;
}
void ArmatureNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceArmatureNodeReader);
}
Offset<Table> ArmatureNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

@ -50,7 +50,7 @@ public:
~ArmatureNodeReader();
static ArmatureNodeReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder) override;

View File

@ -59,7 +59,7 @@ namespace cocostudio
return instanceButtonReader;
}
void ButtonReader::purge()
void ButtonReader::destroyInstance()
{
CC_SAFE_DELETE(instanceButtonReader);
}

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~ButtonReader();
static ButtonReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
const rapidjson::Value& options);

View File

@ -45,6 +45,11 @@ namespace cocostudio
return instanceCheckBoxReader;
}
void CheckBoxReader::destroyInstance()
{
CC_SAFE_DELETE(instanceCheckBoxReader);
}
void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~CheckBoxReader();
static CheckBoxReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -58,7 +58,7 @@ namespace cocostudio
return _instanceComAudioReader;
}
void ComAudioReader::purge()
void ComAudioReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceComAudioReader);
}

View File

@ -40,7 +40,7 @@ namespace cocostudio
~ComAudioReader();
static ComAudioReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -49,6 +49,11 @@ namespace cocostudio
return instanceImageViewReader;
}
void ImageViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceImageViewReader);
}
void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -41,7 +41,7 @@ namespace cocostudio
virtual ~ImageViewReader();
static ImageViewReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -64,6 +64,11 @@ namespace cocostudio
return instanceLayoutReader;
}
void LayoutReader::destroyInstance()
{
CC_SAFE_DELETE(instanceLayoutReader);
}
void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -40,7 +40,7 @@ namespace cocostudio
virtual ~LayoutReader();
static LayoutReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -42,6 +42,11 @@ namespace cocostudio
return instanceListViewReader;
}
void ListViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceListViewReader);
}
void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{
ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~ListViewReader();
static ListViewReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -48,6 +48,11 @@ namespace cocostudio
return instanceLoadingBar;
}
void LoadingBarReader::destroyInstance()
{
CC_SAFE_DELETE(instanceLoadingBar);
}
void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~LoadingBarReader();
static LoadingBarReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -62,7 +62,7 @@ namespace cocostudio
return _instanceNode3DReader;
}
void Node3DReader::purge()
void Node3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceNode3DReader);
}

View File

@ -46,7 +46,7 @@ namespace cocostudio
~Node3DReader();
static Node3DReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -79,7 +79,7 @@ namespace cocostudio
return _instanceNodeReader;
}
void NodeReader::purge()
void NodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceNodeReader);
}

View File

@ -41,7 +41,7 @@ namespace cocostudio
~NodeReader();
static NodeReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -40,6 +40,11 @@ namespace cocostudio
return instancePageViewReader;
}
void PageViewReader::destroyInstance()
{
CC_SAFE_DELETE(instancePageViewReader);
}
void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~PageViewReader();
static PageViewReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ;

View File

@ -63,7 +63,7 @@ namespace cocostudio
return _instanceParticle3DReader;
}
void Particle3DReader::purge()
void Particle3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticle3DReader);
}

View File

@ -41,7 +41,7 @@ namespace cocostudio
~Particle3DReader();
static Particle3DReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -59,7 +59,7 @@ namespace cocostudio
return _instanceParticleReader;
}
void ParticleReader::purge()
void ParticleReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticleReader);
}

View File

@ -42,7 +42,7 @@ namespace cocostudio
~ParticleReader();
static ParticleReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -57,7 +57,7 @@ namespace cocostudio
return _instanceProjectNodeReader;
}
void ProjectNodeReader::purge()
void ProjectNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceProjectNodeReader);
}

View File

@ -40,7 +40,7 @@ namespace cocostudio
~ProjectNodeReader();
static ProjectNodeReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -44,6 +44,11 @@ namespace cocostudio
return instanceScrollViewReader;
}
void ScrollViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceScrollViewReader);
}
void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{
//TODO: need to refactor...

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~ScrollViewReader();
static ScrollViewReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -62,7 +62,7 @@ namespace cocostudio
return _instanceSingleNodeReader;
}
void SingleNodeReader::purge()
void SingleNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSingleNodeReader);
}

View File

@ -42,7 +42,7 @@ namespace cocostudio
~SingleNodeReader();
static SingleNodeReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -48,6 +48,11 @@ namespace cocostudio
return instanceSliderReader;
}
void SliderReader::destroyInstance()
{
CC_SAFE_DELETE(instanceSliderReader);
}
void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{
this->beginSetBasicProperties(widget);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~SliderReader();
static SliderReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -62,7 +62,7 @@ namespace cocostudio
return _instanceSprite3DReader;
}
void Sprite3DReader::purge()
void Sprite3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSprite3DReader);
}

View File

@ -46,7 +46,7 @@ namespace cocostudio
~Sprite3DReader();
static Sprite3DReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -60,7 +60,7 @@ namespace cocostudio
return _instanceSpriteReader;
}
void SpriteReader::purge()
void SpriteReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSpriteReader);
}

View File

@ -42,7 +42,7 @@ namespace cocostudio
~SpriteReader();
static SpriteReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -45,6 +45,11 @@ namespace cocostudio
return instanceTextAtalsReader;
}
void TextAtlasReader::destroyInstance()
{
CC_SAFE_DELETE(instanceTextAtalsReader);
}
void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
this->beginSetBasicProperties(widget);

View File

@ -39,6 +39,7 @@ namespace cocostudio
virtual ~TextAtlasReader();
static TextAtlasReader* getInstance();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -42,6 +42,11 @@ namespace cocostudio
return instanceTextBMFontReader;
}
void TextBMFontReader::destroyInstance()
{
CC_SAFE_DELETE(instanceTextBMFontReader);
}
void TextBMFontReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
this->beginSetBasicProperties(widget);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~TextBMFontReader();
static TextBMFontReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -49,6 +49,11 @@ namespace cocostudio
return instanceTextFieldReader;
}
void TextFieldReader::destroyInstance()
{
CC_SAFE_DELETE(instanceTextFieldReader);
}
void TextFieldReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{
this->beginSetBasicProperties(widget);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~TextFieldReader();
static TextFieldReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -47,6 +47,11 @@ namespace cocostudio
return instanceTextReader;
}
void TextReader::destroyInstance()
{
CC_SAFE_DELETE(instanceTextReader);
}
void TextReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
this->beginSetBasicProperties(widget);

View File

@ -39,7 +39,7 @@ namespace cocostudio
virtual ~TextReader();
static TextReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -61,7 +61,7 @@ namespace cocostudio
return _instanceUserCameraReader;
}
void UserCameraReader::purge()
void UserCameraReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceUserCameraReader);
}

View File

@ -46,7 +46,7 @@ namespace cocostudio
~UserCameraReader();
static UserCameraReader* getInstance();
static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);

View File

@ -134,7 +134,7 @@ namespace cocostudio
return instanceWidgetReader;
}
void WidgetReader::purge()
void WidgetReader::destroyInstance()
{
CC_SAFE_DELETE(instanceWidgetReader);
}

View File

@ -46,7 +46,7 @@ namespace cocostudio
virtual ~WidgetReader();
static WidgetReader* getInstance();
static void purge();
static void destroyInstance();
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
const rapidjson::Value& options);