本文整理汇总了C++中YamlNode::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ YamlNode::Set方法的具体用法?C++ YamlNode::Set怎么用?C++ YamlNode::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YamlNode
的用法示例。
在下文中一共展示了YamlNode::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveBackground
YamlNode * UISlider::SaveToYamlNode(UIYamlLoader * loader)
{
thumbButton->SetName(UISLIDER_THUMB_SPRITE_CONTROL_NAME);
YamlNode *node = UIControl::SaveToYamlNode(loader);
// Sprite value
float32 value = this->GetValue();
node->Set("value", value);
// Sprite min value
value = this->GetMinValue();
node->Set("minValue", value);
// Sprite max value
value = this->GetMaxValue();
node->Set("maxValue", value);
// Min/max background sprites.
SaveBackground("min", minBackground, node, loader);
SaveBackground("max", maxBackground, node, loader);
// Sprites are now embedded into UISlider.
node->Set("spritesEmbedded", true);
return node;
}
示例2:
YamlNode * UIList::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
//Temp variable
String stringValue;
//Control Type
node->Set("type", "UIList");
//Orientation
eListOrientation orient = this->GetOrientation();
switch(orient)
{
case ORIENTATION_VERTICAL:
stringValue = "ORIENTATION_VERTICAL";
break;
case ORIENTATION_HORIZONTAL:
stringValue = "ORIENTATION_HORIZONTAL";
break;
default:
stringValue = "ORIENTATION_VERTICAL";
break;
}
node->Set("orientation", stringValue);
return node;
}
示例3: SaveToYamlNode
YamlNode* UIJoypad::SaveToYamlNode(DAVA::UIYamlLoader *loader)
{
UIJoypad* baseControl = new UIJoypad();
YamlNode *node = UIControl::SaveToYamlNode(loader);
// Sprite
if (stick && stick->GetSprite())
{
node->Set("stickSprite", Sprite::GetPathString(stick->GetSprite()));
node->Set("stickFrame", stick->GetFrame());
}
if (baseControl->GetDeadAreaSize() != GetDeadAreaSize())
{
node->Set("deadAreaSize", GetDeadAreaSize());
}
if (baseControl->GetDigitalSense() != GetDigitalSense())
{
node->Set("digitalSense", GetDigitalSense());
}
SafeRelease(baseControl);
return node;
}
示例4: UIStaticText
YamlNode * UIStaticText::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
UIStaticText *baseControl = new UIStaticText();
//Temp variable
VariantType *nodeValue = new VariantType();
//Control Type
SetPreferredNodeType(node, "UIStaticText");
//Font
//Get font name and put it here
nodeValue->SetString(FontManager::Instance()->GetFontName(this->GetFont()));
node->Set("font", nodeValue);
//TextColor
nodeValue->SetVector4(Vector4(textColor.r, textColor.g, textColor.b, textColor.a));
node->Set("textcolor", nodeValue);
// ShadowColor
nodeValue->SetVector4(Vector4(shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a));
node->Set("shadowcolor", nodeValue);
// ShadowOffset
nodeValue->SetVector2(GetShadowOffset());
node->Set("shadowoffset", nodeValue);
//Text
nodeValue->SetWideString(GetText());
node->Set("text", nodeValue);
//Multiline
if (baseControl->textBlock->GetMultiline() != this->textBlock->GetMultiline())
{
node->Set("multiline", this->textBlock->GetMultiline());
}
//multilineBySymbol
if (baseControl->textBlock->GetMultilineBySymbol() != this->textBlock->GetMultilineBySymbol())
{
node->Set("multilineBySymbol", this->textBlock->GetMultilineBySymbol());
}
//fitting - STRING OF INT???
if (baseControl->textBlock->GetFittingOption() != this->textBlock->GetFittingOption())
{
node->Set("fitting", this->textBlock->GetFittingOption());
}
// Align
node->SetNodeToMap("textalign", loader->GetAlignNodeValue(this->GetTextAlign()));
// Draw type. Must be overriden for UITextControls.
node->Set("drawType", loader->GetDrawTypeNodeValue(this->GetBackground()->GetDrawType()));
SafeDelete(nodeValue);
SafeRelease(baseControl);
return node;
}
示例5: YamlNode
YamlNode * Font::SaveToYamlNode() const
{
YamlNode *node = new YamlNode(YamlNode::TYPE_MAP);
VariantType *nodeValue = new VariantType();
//Type
node->Set("type", "Font");
//Font size
node->Set("size", this->GetSize());
//Vertical Spacing
node->Set("verticalSpacing", this->GetVerticalSpacing());
SafeDelete(nodeValue);
return node;
}
示例6: SaveToYamlNode
YamlNode* UIAggregatorControl::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode* node = UIControl::SaveToYamlNode(loader);
SetPreferredNodeType(node, "UIAggregatorControl");
node->Set(AGGREGATOR_PATH, aggregatorPath.GetAbsolutePathname());
return node;
}
示例7:
YamlNode * UIScrollBar::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
//Temp variables
String stringValue;
//Control Type
SetPreferredNodeType(node, "UIScrollBar");
//Orientation
eScrollOrientation orient = this->GetOrientation();
switch(orient)
{
case ORIENTATION_VERTICAL:
stringValue = "ORIENTATION_VERTICAL";
break;
case ORIENTATION_HORIZONTAL:
stringValue = "ORIENTATION_HORIZONTAL";
break;
default:
stringValue = "ORIENTATION_VERTICAL";
break;
}
node->Set("orientation", stringValue);
// Slider have to be saved too.
YamlNode* sliderNode = slider->SaveToYamlNode(loader);
node->AddNodeToMap(UISCROLLBAR_SLIDER_NAME, sliderNode);
return node;
}
示例8: SaveToYaml
void ParticleEmitter::SaveToYaml(const String & filename)
{
YamlParser* parser = YamlParser::Create();
if (!parser)
{
Logger::Error("ParticleEmitter::SaveToYaml() - unable to create parser!");
return;
}
YamlNode* rootYamlNode = new YamlNode(YamlNode::TYPE_MAP);
YamlNode* emitterYamlNode = new YamlNode(YamlNode::TYPE_MAP);
rootYamlNode->AddNodeToMap("emitter", emitterYamlNode);
emitterYamlNode->Set("3d", this->is3D);
emitterYamlNode->Set("type", GetEmitterTypeName());
// Write the property lines.
PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "emissionAngle", this->emissionAngle);
PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "emissionRange", this->emissionRange);
PropertyLineYamlWriter::WritePropertyLineToYamlNode<Vector3>(emitterYamlNode, "emissionVector", this->emissionVector);
// Yuri Coder, 2013/04/12. After the coordinates inversion for the emission vector we need to introduce the
// new "emissionVectorInverted" flag to mark we don't need to invert coordinates after re-loading the YAML.
PropertyLineYamlWriter::WritePropertyValueToYamlNode<bool>(emitterYamlNode, "emissionVectorInverted", true);
PropertyLineYamlWriter::WritePropertyLineToYamlNode<float32>(emitterYamlNode, "radius", this->radius);
PropertyLineYamlWriter::WriteColorPropertyLineToYamlNode(emitterYamlNode, "colorOverLife", this->colorOverLife);
PropertyLineYamlWriter::WritePropertyLineToYamlNode<Vector3>(emitterYamlNode, "size", this->size);
PropertyLineYamlWriter::WritePropertyValueToYamlNode<float32>(emitterYamlNode, "life", this->lifeTime);
// Now write all the Layers. Note - layers are child of root node, not the emitter one.
int32 layersCount = this->layers.size();
for (int32 i = 0; i < layersCount; i ++)
{
this->layers[i]->SaveToYamlNode(rootYamlNode, i);
}
parser->SaveToYamlFile(filename, rootYamlNode, true);
parser->Release();
}
示例9: TruncateTxtFileExtension
YamlNode * GraphicsFont::SaveToYamlNode()
{
YamlNode *node = Font::SaveToYamlNode();
//Type
node->Set("type", "GraphicsFont");
//horizontalSpacing
node->Set("horizontalSpacing", this->GetHorizontalSpacing());
//Sprite
Sprite *sprite = this->fontSprite;
if (sprite)
{
//Truncate sprite ".txt" extension before save
node->Set("sprite", TruncateTxtFileExtension(sprite->GetName()));
}
//Font Definition
node->Set("definition", this->GetFontDefinitionName());
return node;
}
示例10:
YamlNode * UIListCell::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
//Control Type
SetPreferredNodeType(node, "UIListCell");
//Identifier
node->Set("identifier", this->GetIdentifier());
return node;
}
示例11: path
YamlNode * GraphicsFont::SaveToYamlNode()
{
YamlNode *node = Font::SaveToYamlNode();
//Type
node->Set("type", "GraphicsFont");
//horizontalSpacing
node->Set("horizontalSpacing", this->GetHorizontalSpacing());
//Sprite
Sprite *sprite = this->fontSprite;
if (sprite)
{
//Truncate sprite ".txt" extension before save
FilePath path(sprite->GetRelativePathname());
path.TruncateExtension();
node->Set("sprite", path.GetAbsolutePathname());
}
//Font Definition
node->Set("definition", this->GetFontDefinitionName().GetAbsolutePathname());
return node;
}
示例12: Save
bool HierarchyTreePlatformNode::Save(YamlNode* node)
{
YamlNode* platform = new YamlNode(YamlNode::TYPE_MAP);
platform->Set(WIDTH_NODE, GetWidth());
platform->Set(HEIGHT_NODE, GetHeight());
Map<String, YamlNode*> &platformsMap = node->AsMap();
platformsMap[GetName().toStdString()] = platform;
ActivatePlatform();
Map<String, YamlNode*> &platformMap = platform->AsMap();
YamlNode* screens = new YamlNode(YamlNode::TYPE_ARRAY);
platformMap[SCREENS_NODE] = screens;
// Add the Localization info - specific for each Platform.
SaveLocalization(platform);
QString projectFolder = GetResourceFolder();
projectFolder += "UI";
QDir dir;
dir.mkpath(projectFolder);
bool result = true;
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
if (!screenNode)
continue;
QString screenPath = QString(SCREEN_PATH).arg(GetResourceFolder()).arg(screenNode->GetName());
result &= screenNode->Save(screenPath);
screens->AddValueToArray(screenNode->GetName().toStdString());
}
return result;
}
示例13: VariantType
YamlNode * UITextField::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
//Temp variable
VariantType *nodeValue = new VariantType();
//Control Type
SetPreferredNodeType(node, "UITextField");
//Text
nodeValue->SetWideString(this->GetText());
node->Set("text", nodeValue);
//Font
//Get font name and put it here
nodeValue->SetString(FontManager::Instance()->GetFontName(this->GetFont()));
node->Set("font", nodeValue);
//TextColor
Color textColor = GetTextColor();
nodeValue->SetVector4(Vector4(textColor.r, textColor.g, textColor.b, textColor.a));
node->Set("textcolor", nodeValue);
// ShadowColor
Color shadowColor = GetShadowColor();
nodeValue->SetVector4(Vector4(shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a));
node->Set("shadowcolor", nodeValue);
// ShadowOffset
nodeValue->SetVector2(GetShadowOffset());
node->Set("shadowoffset", nodeValue);
// Text align
node->SetNodeToMap("textalign", loader->GetAlignNodeValue(this->GetTextAlign()));
// Draw Type must be overwritten fot UITextField.
UIControlBackground::eDrawType drawType = this->GetBackground()->GetDrawType();
node->Set("drawType", loader->GetDrawTypeNodeValue(drawType));
SafeDelete(nodeValue);
return node;
}
示例14: VariantType
YamlNode * UIStaticText::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode *node = UIControl::SaveToYamlNode(loader);
// Sprite node is not needed for UITextField.
YamlNode *spriteNode = node->Get("sprite");
if (spriteNode)
{
node->RemoveNodeFromMap("sprite");
}
//Temp variable
VariantType *nodeValue = new VariantType();
//Control Type
node->Set("type", "UIStaticText");
//Font
//Get font name and put it here
nodeValue->SetString(FontManager::Instance()->GetFontName(this->GetFont()));
node->Set("font", nodeValue);
//Text
nodeValue->SetWideString(GetText());
node->Set("text", nodeValue);
//Multiline
node->Set("multiline", this->textBlock->GetMultiline());
//multilineBySymbol
node->Set("multilineBySymbol", this->textBlock->GetMultilineBySymbol());
//fitting - STRING OF INT???
node->Set("fitting", this->textBlock->GetFittingOption());
SafeDelete(nodeValue);
return node;
}
示例15: SaveToYamlNode
YamlNode* UIAggregatorControl::SaveToYamlNode(UIYamlLoader * loader)
{
YamlNode* node = UIControl::SaveToYamlNode(loader);
node->Set(AGGREGATOR_PATH, aggregatorPath.GetFrameworkPath());
return node;
}