Merge pull request #11229 from xiaofeng11/v3

Add destroyCocosStudio()
This commit is contained in:
minggo 2015-04-01 10:49:49 +08:00
commit eefd06415b
74 changed files with 343 additions and 37 deletions

View File

@ -1282,6 +1282,8 @@
38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */; };
38B8E2E319E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; };
38B8E2E419E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; };
38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; };
38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; };
38F5263E1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; };
38F5263F1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; };
38F526401A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; };
@ -3109,6 +3111,7 @@
38B8E2D419E66581002D7CE7 /* CSLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLoader.h; sourceTree = "<group>"; };
38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutComponent.cpp; sourceTree = "<group>"; };
38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutComponent.h; sourceTree = "<group>"; };
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoStudio.cpp; sourceTree = "<group>"; };
38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; };
38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; };
38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; };
@ -4868,6 +4871,7 @@
1A8C5984180E930E00EF57C3 /* CCUtilMath.cpp */,
1A8C5985180E930E00EF57C3 /* CCUtilMath.h */,
1A8C5986180E930E00EF57C3 /* CocoStudio.h */,
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */,
1A8C5989180E930E00EF57C3 /* DictionaryHelper.cpp */,
1A8C598A180E930E00EF57C3 /* DictionaryHelper.h */,
);
@ -8602,6 +8606,7 @@
B665E2561AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.cpp in Sources */,
15AE18A419AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */,
182C5CD61A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
B665E3D61AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */,
15AE1B5719AADA9900C27E9E /* UISlider.cpp in Sources */,
B665E2F61AA80A6500DDB1C5 /* CCPUListener.cpp in Sources */,
@ -9044,6 +9049,7 @@
B665E3AF1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */,
382383FB1A258FA7002C4610 /* idl_gen_go.cpp in Sources */,
B665E2EF1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */,
38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
50ABBDBA1925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */,
1A5702FB180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */,
B665E40B1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */,

View File

@ -514,6 +514,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -1795,6 +1795,9 @@
<ClCompile Include="..\editor-support\cocostudio\CCObjectExtensionData.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">

View File

@ -947,6 +947,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)targetver.h" />
@ -3312,6 +3312,9 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTextureCube.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="2d">

View File

@ -538,6 +538,7 @@
<ClInclude Include="..\editor-support\cocostudio\CCTween.h" />
<ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
@ -1179,6 +1180,7 @@
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -1815,6 +1815,9 @@
<ClCompile Include="..\3d\CCTextureCube.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CCAction.h">
@ -3528,6 +3531,9 @@
<ClInclude Include="..\3d\CCTextureCube.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -72,7 +72,8 @@ public:
static void destroyInstance();
CSLoader();
void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE void purge();
void init();

View File

@ -75,7 +75,8 @@ ActionTimeline/CSLoader.cpp \
FlatBuffersSerialize.cpp \
WidgetCallBackHandlerProtocol.cpp \
WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp \
CCObjectExtensionData.cpp
CCObjectExtensionData.cpp \
CocoStudio.cpp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..

View File

@ -44,6 +44,7 @@ set(COCOS_CS_SRC
editor-support/cocostudio/TriggerObj.cpp
editor-support/cocostudio/FlatBuffersSerialize.cpp
editor-support/cocostudio/CCObjectExtensionData.cpp
editor-support/cocostudio/CocoStudio.cpp
editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp
editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp
editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp

View File

@ -0,0 +1,67 @@
#include "CocoStudio.h"
#include "cocostudio/WidgetReader/NodeReader/NodeReader.h"
#include "cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h"
#include "cocostudio/WidgetReader/SpriteReader/SpriteReader.h"
#include "cocostudio/WidgetReader/ParticleReader/ParticleReader.h"
#include "cocostudio/WidgetReader/GameMapReader/GameMapReader.h"
#include "cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h"
#include "cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h"
#include "cocostudio/WidgetReader/ButtonReader/ButtonReader.h"
#include "cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h"
#include "cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h"
#include "cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h"
#include "cocostudio/WidgetReader/TextReader/TextReader.h"
#include "cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h"
#include "cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h"
#include "cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h"
#include "cocostudio/WidgetReader/SliderReader/SliderReader.h"
#include "cocostudio/WidgetReader/LayoutReader/LayoutReader.h"
#include "cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h"
#include "cocostudio/WidgetReader/PageViewReader/PageViewReader.h"
#include "cocostudio/WidgetReader/ListViewReader/ListViewReader.h"
#include "cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h"
#include "cocostudio/WidgetReader/Node3DReader/Node3DReader.h"
#include "cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h"
#include "cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h"
#include "cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h"
namespace cocostudio
{
void destroyCocosStudio()
{
NodeReader::destroyInstance();
SingleNodeReader::destroyInstance();
SpriteReader::destroyInstance();
ParticleReader::destroyInstance();
GameMapReader::destroyInstance();
ProjectNodeReader::destroyInstance();
ComAudioReader::destroyInstance();
WidgetReader::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();
cocos2d::CSLoader::destroyInstance();
}
}

View File

@ -65,4 +65,11 @@ THE SOFTWARE.
#include "cocostudio/CocosStudioExport.h"
#include "cocostudio/ActionTimeline/CSLoader.h"
#include "cocostudio/CocosStudioExport.h"
namespace cocostudio
{
void CC_STUDIO_DLL destroyCocosStudio();
}
#endif

View File

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

View File

@ -91,7 +91,9 @@ class CC_STUDIO_DLL FlatBuffersSerialize
public:
static FlatBuffersSerialize* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -26,7 +26,6 @@ THE SOFTWARE.
#define __ARMATURENODEREADER_H_
#include "cocos2d.h"
#include "cocostudio/FlatBuffersSerialize.h"
#include "cocostudio/WidgetReader/NodeReaderProtocol.h"
#include "cocostudio/WidgetReader/NodeReaderDefine.h"
@ -50,7 +49,9 @@ public:
~ArmatureNodeReader();
static ArmatureNodeReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder) override;

View File

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

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~ButtonReader();
static ButtonReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~CheckBoxReader();
static CheckBoxReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -63,6 +63,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceComAudioReader);
}
void ComAudioReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceComAudioReader);
}
Offset<Table> ComAudioReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

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

View File

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

View File

@ -42,7 +42,9 @@ namespace cocostudio
~GameMapReader();
static GameMapReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~ImageViewReader();
static ImageViewReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~LayoutReader();
static LayoutReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~ListViewReader();
static ListViewReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~LoadingBarReader();
static LoadingBarReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceNode3DReader);
}
void Node3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceNode3DReader);
}
Vec3 Node3DReader::getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const
{
if(!attribute)

View File

@ -46,7 +46,9 @@ namespace cocostudio
~Node3DReader();
static Node3DReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
~NodeReader();
static NodeReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~PageViewReader();
static PageViewReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -68,6 +68,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceParticle3DReader);
}
void Particle3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticle3DReader);
}
Offset<Table> Particle3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

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

View File

@ -64,6 +64,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceParticleReader);
}
void ParticleReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticleReader);
}
Offset<Table> ParticleReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

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

View File

@ -62,6 +62,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceProjectNodeReader);
}
void ProjectNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceProjectNodeReader);
}
Offset<Table> ProjectNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

@ -40,7 +40,9 @@ namespace cocostudio
~ProjectNodeReader();
static ProjectNodeReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~ScrollViewReader();
static ScrollViewReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSingleNodeReader);
}
void SingleNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSingleNodeReader);
}
Offset<Table> SingleNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

@ -42,7 +42,9 @@ namespace cocostudio
~SingleNodeReader();
static SingleNodeReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~SliderReader();
static SliderReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSprite3DReader);
}
void Sprite3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSprite3DReader);
}
Vec2 Sprite3DReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const
{
if(!attribute)

View File

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

View File

@ -65,6 +65,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSpriteReader);
}
void SpriteReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSpriteReader);
}
Offset<Table> SpriteReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{

View File

@ -42,7 +42,9 @@ namespace cocostudio
~SpriteReader();
static SpriteReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~TextAtlasReader();
static TextAtlasReader* getInstance();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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 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,9 @@ namespace cocostudio
virtual ~TextBMFontReader();
static TextBMFontReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~TextFieldReader();
static TextFieldReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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,9 @@ namespace cocostudio
virtual ~TextReader();
static TextReader* getInstance();
static void purge();
/** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE 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

@ -66,6 +66,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceUserCameraReader);
}
void UserCameraReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceUserCameraReader);
}
Vec2 UserCameraReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const
{
if(!attribute)

View File

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

View File

@ -139,6 +139,11 @@ namespace cocostudio
CC_SAFE_DELETE(instanceWidgetReader);
}
void WidgetReader::destroyInstance()
{
CC_SAFE_DELETE(instanceWidgetReader);
}
void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
{

View File

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

View File

@ -102,6 +102,13 @@ void CocosStudio3DTestDemo::onEnter()
BaseTest::onEnter();
}
void CocosStudio3DTestDemo::onExit()
{
cocostudio::destroyCocosStudio();
BaseTest::onExit();
}
void CocosStudio3DTestDemo::restartCallback(Ref* sender)
{
auto s = new (std::nothrow) CS3DTestScene();

View File

@ -47,6 +47,7 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void onEnter() override;
virtual void onExit() override;
};
class CSNode3DTest : public CocosStudio3DTestDemo

View File

@ -164,9 +164,8 @@ void ActionTimelineTestLayer::onExit()
removeAllChildren();
backItem = restartItem = nextItem = nullptr;
ActionTimelineCache::getInstance()->purge();
CSLoader::getInstance()->purge();
cocostudio::destroyCocosStudio();
Layer::onExit();
}

View File

@ -199,6 +199,8 @@ void ArmatureTestLayer::onExit()
removeAllChildren();
backItem = restartItem = nextItem = nullptr;
cocostudio::destroyCocosStudio();
Layer::onExit();
}

View File

@ -4,6 +4,7 @@
#include "../../CustomGUIScene.h"
#include "cocostudio/ActionTimeline/CSLoader.h"
#include "cocostudio/CocoStudio.h"
#include "base/ObjectFactory.h"
@ -31,6 +32,13 @@ void CustomWidgetCallbackBindScene::onEnter()
addChild(pMenu, 1);
}
void CustomWidgetCallbackBindScene::onExit()
{
cocostudio::destroyCocosStudio();
Scene::onExit();
}
void CustomWidgetCallbackBindScene::runThisTest()
{
CSLoader* instance = CSLoader::getInstance();

View File

@ -10,6 +10,7 @@ class CustomWidgetCallbackBindScene : public TestScene
{
public:
virtual void onEnter() override;
virtual void onExit() override;
virtual void runThisTest();
void BackCallback(cocos2d::Ref* pSender);
};

View File

@ -19,6 +19,13 @@ UIScene_Editor::~UIScene_Editor()
}
void UIScene_Editor::onExit()
{
cocostudio::destroyCocosStudio();
Layer::onExit();
}
bool UIScene_Editor::init()
{
if (CCLayer::init())

View File

@ -59,6 +59,8 @@ public:
UIScene_Editor();
~UIScene_Editor();
virtual void onExit() override;
bool init();
virtual void previousCallback(Ref* sender, Widget::TouchEventType event);
virtual void nextCallback(Ref* sender, Widget::TouchEventType event);