axmol/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp

57 lines
1.5 KiB
C++
Raw Normal View History

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()
{
}
static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = nullptr;
2014-03-07 15:36:45 +08:00
CustomParticleWidgetReader* CustomParticleWidgetReader::getInstance()
{
if (!_instanceCustomParticleWidgetReader)
{
_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-03-07 15:36:45 +08:00
}
}