| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include "RecipieGroupConfig.h"
- #include "Game.h"
- RecipieGroupConfig::RecipieGroupConfig()
- : Framework::ReferenceCounter()
- {}
- void RecipieGroupConfig::setGroupName(const Framework::Text& groupName)
- {
- this->groupName = groupName;
- }
- const Framework::Text& RecipieGroupConfig::getGroupName() const
- {
- return groupName;
- }
- void RecipieGroupConfig::setIconItemType(const Framework::Text& iconItemType)
- {
- this->iconItemType = iconItemType;
- }
- const Framework::Text& RecipieGroupConfig::getIconItemType() const
- {
- return iconItemType;
- }
- RecipieGroupConfigFactory::RecipieGroupConfigFactory()
- : ObjectTypeFactory<RecipieGroupConfig>()
- {}
- RecipieGroupConfig* RecipieGroupConfigFactory::fromJson(
- Framework::JSON::JSONObject* zJson) const
- {
- RecipieGroupConfig* config = new RecipieGroupConfig();
- config->setGroupName(zJson->zValue("groupName")->asString()->getString());
- config->setIconItemType(
- zJson->zValue("iconItemType")->asString()->getString());
- return config;
- }
- Framework::JSON::JSONObject* RecipieGroupConfigFactory::toJsonObject(
- RecipieGroupConfig* zObject) const
- {
- Framework::JSON::JSONObject* result = new Framework::JSON::JSONObject();
- result->addValue("groupName",
- new Framework::JSON::JSONString(zObject->getGroupName().getText()));
- result->addValue("iconItemType",
- new Framework::JSON::JSONString(zObject->getIconItemType().getText()));
- return result;
- }
- JSONObjectValidationBuilder* RecipieGroupConfigFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return builder->withRequiredString("groupName")
- ->finishString()
- ->withRequiredAttribute("iconItemType",
- Game::INSTANCE->zTypeRegistry()->getValidator<Framework::Text>(
- ItemTypeNameFactory::TYPE_ID));
- }
|