2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "CustomReader.h"
|
|
|
|
#include "CustomImageView.h"
|
|
|
|
|
2015-04-09 08:37:30 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
|
|
|
using namespace cocos2d::ui;
|
|
|
|
using namespace cocostudio;
|
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
static CustomReader* _instanceCustomReader = nullptr;
|
2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
CustomReader::CustomReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomReader::~CustomReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomReader* CustomReader::getInstance()
|
|
|
|
{
|
|
|
|
if (!_instanceCustomReader)
|
|
|
|
{
|
2014-08-28 07:31:57 +08:00
|
|
|
_instanceCustomReader = new (std::nothrow) CustomReader();
|
2014-03-04 16:51:35 +08:00
|
|
|
}
|
|
|
|
return _instanceCustomReader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomReader::setProperties(const std::string &classType, Widget *widget, const rapidjson::Value &customOptions)
|
|
|
|
{
|
|
|
|
if (classType.compare("CustomImageView") == 0)
|
|
|
|
{
|
|
|
|
CustomImageView* customImageView = static_cast<CustomImageView*>(widget);
|
|
|
|
|
|
|
|
bool isExistText = DICTOOL->getBooleanValue_json(customOptions, "text");
|
|
|
|
if (isExistText)
|
|
|
|
{
|
|
|
|
const char* text = DICTOOL->getStringValue_json(customOptions, "text");
|
|
|
|
customImageView->setText(text);
|
|
|
|
}
|
|
|
|
}
|
2014-06-19 19:45:24 +08:00
|
|
|
}
|