本文整理汇总了C++中gd::SerializerElement::HasChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::HasChild方法的具体用法?C++ SerializerElement::HasChild怎么用?C++ SerializerElement::HasChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::SerializerElement
的用法示例。
在下文中一共展示了SerializerElement::HasChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoUnserializeFrom
void TileMapObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
if(element.HasChild("tileSet"))
{
tileSet.Get().UnserializeFrom(element.GetChild("tileSet"));
}
if(element.HasChild("tileMap"))
{
tileMap.Get().UnserializeFrom(element.GetChild("tileMap"));
}
}
示例2: UnserializeFrom
void ScenePathDatas::UnserializeFrom(const gd::SerializerElement & element)
{
globalPaths.clear();
if (!element.HasChild("paths", "Paths")) return;
const gd::SerializerElement & pathsElement = element.GetChild("paths", 0, "Paths");
pathsElement.ConsiderAsArrayOf("path", "Path");
for (int i = 0; i < pathsElement.GetChildrenCount(); ++i)
{
const gd::SerializerElement & pathElement = pathsElement.GetChild(i);
globalPaths[pathElement.GetStringAttribute("name")] = PathBehavior::GetCoordsVectorFromString(pathElement.GetStringAttribute("coords"), '/', ';');
}
}
示例3: UnserializeFrom
void TileSet::UnserializeFrom(const gd::SerializerElement &element)
{
int serializationVersion = element.GetIntAttribute("version", 1);
textureName = element.GetStringAttribute("textureName", "");
tileSize.x = element.GetIntAttribute("tileSizeX", 32);
tileSize.y = element.GetIntAttribute("tileSizeY", 32);
tileSpacing.x = element.GetIntAttribute("tileSpacingX", 0);
tileSpacing.y = element.GetIntAttribute("tileSpacingY", 0);
ResetHitboxes();
m_collidable.clear();
if(serializationVersion == 1)
{
if(element.HasChild("hitboxes"))
{
gd::SerializerElement &tilesElem = element.GetChild("hitboxes");
tilesElem.ConsiderAsArrayOf("tileHitbox");
for(int i = 0; i < tilesElem.GetChildrenCount("tileHitbox"); i++)
{
m_collidable.push_back(tilesElem.GetChild(i).GetBoolAttribute("collidable", true));
TileHitbox newHitbox;
newHitbox.UnserializeFrom(tilesElem.GetChild(i), tileSize);
if(newHitbox != TileHitbox::Rectangle(tileSize))
m_hitboxes[i] = newHitbox;
}
}
}
else if(serializationVersion == 2)
{
gd::SerializerElement &collidableElem = element.GetChild("collidable");
collidableElem.ConsiderAsArrayOf("tile");
for(int i = 0; i < collidableElem.GetChildrenCount("tile"); i++)
{
m_collidable.push_back(collidableElem.GetChild(i).GetBoolAttribute("collidable", true));
}
gd::SerializerElement &hitboxesElem = element.GetChild("hitboxes");
hitboxesElem.ConsiderAsArrayOf("tileHitbox");
for(int i = 0; i < hitboxesElem.GetChildrenCount("tileHitbox"); i++)
{
m_hitboxes[hitboxesElem.GetChild(i).GetIntAttribute("tileId", -1)].UnserializeFrom(hitboxesElem.GetChild(i), tileSize);
}
}
}
示例4: UnserializeFrom
void TileSet::UnserializeFrom(const gd::SerializerElement &element)
{
ResetHitboxes();
textureName = element.GetStringAttribute("textureName", "");
tileSize.x = element.GetIntAttribute("tileSizeX", 32);
tileSize.y = element.GetIntAttribute("tileSizeY", 32);
tileSpacing.x = element.GetIntAttribute("tileSpacingX", 0);
tileSpacing.y = element.GetIntAttribute("tileSpacingY", 0);
if (element.HasChild("hitboxes"))
{
gd::SerializerElement &tilesElem = element.GetChild("hitboxes");
tilesElem.ConsiderAsArrayOf("tileHitbox");
for(int i = 0; i < tilesElem.GetChildrenCount("tileHitbox"); i++)
{
TileHitbox newHitbox;
newHitbox.UnserializeFrom(tilesElem.GetChild(i), tileSize);
m_hitboxes.push_back(newHitbox);
}
}
m_dirty = true;
}