2014-03-07 15:36:45 +08:00
|
|
|
//
|
|
|
|
// CustomParticleWidgetReader.cpp
|
|
|
|
// CustomUI
|
|
|
|
//
|
|
|
|
// Created by cai wenzhi on 14-3-7.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "CustomParticleWidgetReader.h"
|
|
|
|
#include "CustomParticleWidget.h"
|
2014-03-12 10:07:55 +08:00
|
|
|
#include "cocostudio/CCSGUIReader.h"
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
|
|
|
using namespace ui;
|
|
|
|
using namespace cocostudio;
|
|
|
|
|
|
|
|
CustomParticleWidgetReader::CustomParticleWidgetReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomParticleWidgetReader::~CustomParticleWidgetReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = nullptr;
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
CustomParticleWidgetReader* CustomParticleWidgetReader::getInstance()
|
|
|
|
{
|
|
|
|
if (!_instanceCustomParticleWidgetReader)
|
|
|
|
{
|
2014-08-28 07:31:57 +08:00
|
|
|
_instanceCustomParticleWidgetReader = new (std::nothrow) CustomParticleWidgetReader();
|
2014-03-07 15:36:45 +08:00
|
|
|
}
|
|
|
|
return _instanceCustomParticleWidgetReader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomParticleWidgetReader::setProperties(const std::string& classType,
|
|
|
|
Widget *widget,
|
|
|
|
const rapidjson::Value &customOptions)
|
|
|
|
{
|
2014-03-12 10:07:55 +08:00
|
|
|
GUIReader* guiReader = GUIReader::getInstance();
|
2014-03-07 15:36:45 +08:00
|
|
|
|
|
|
|
CustomParticleWidget* custom = static_cast<CustomParticleWidget*>(widget);
|
|
|
|
|
2014-03-12 10:07:55 +08:00
|
|
|
bool isExistPlistFile = DICTOOL->checkObjectExist_json(customOptions, "PlistFile");
|
|
|
|
if (isExistPlistFile)
|
2014-03-07 15:36:45 +08:00
|
|
|
{
|
2014-03-12 10:07:55 +08:00
|
|
|
const char* PlistFile = DICTOOL->getStringValue_json(customOptions, "PlistFile");
|
|
|
|
std::string PlistFilePath = guiReader->getFilePath();
|
|
|
|
PlistFilePath.append(PlistFile);
|
|
|
|
custom->setParticlePlist(PlistFilePath.c_str());
|
2014-07-09 11:35:53 +08:00
|
|
|
|
2014-03-07 15:36:45 +08:00
|
|
|
}
|
|
|
|
}
|