本文整理汇总了C++中XmlNodeRef::getTag方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlNodeRef::getTag方法的具体用法?C++ XmlNodeRef::getTag怎么用?C++ XmlNodeRef::getTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNodeRef
的用法示例。
在下文中一共展示了XmlNodeRef::getTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::Init( XmlNodeRef xml )
{
const int numChildren = xml->getChildCount();
for (int childIdx = 0; childIdx < numChildren; ++ childIdx)
{
XmlNodeRef xmlChild = xml->getChild(childIdx);
if (!stricmp(xmlChild->getTag(), "SpawnParams"))
{
const char *pType = 0;
if (xmlChild->getAttr("type", &pType))
{
if (!stricmp(pType, "avoid"))
{
m_spawnPOIType = eSPT_Avoid;
}
else
{
CryLog("CGameRulesHoldObjectiveBase::Init: ERROR: Unknown spawn point of interest type ('%s')", pType);
}
xmlChild->getAttr("distance", m_spawnPOIDistance);
}
}
else if (!stricmp(xmlChild->getTag(), "EffectData"))
{
InitEffectData(xmlChild);
}
}
for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
{
m_entities[i].Reset();
}
}
示例2: LoadXmlData
void CForceFeedBackSystem::LoadXmlData()
{
const char* xmlDataFile = "Libs/GameForceFeedback/ForceFeedbackEffects.xml";
XmlNodeRef rootNode = gEnv->pSystem->LoadXmlFromFile(xmlDataFile);
if (!rootNode || strcmpi(rootNode->getTag(), "ForceFeedback"))
{
FORCEFEEDBACK_LOG("Could not load force feedback system data. Invalid XML file '%s'! ", xmlDataFile);
return;
}
const int childCount = rootNode->getChildCount();
for (int i = 0; i < childCount; ++i)
{
XmlNodeRef childNode = rootNode->getChild(i);
const char* childTag = childNode->getTag();
if (strcmp(childTag, "Patterns") == 0)
{
LoadPatters(childNode);
}
else if (strcmp(childTag, "Envelopes") == 0)
{
LoadEnvelopes(childNode);
}
else if (strcmp(childTag, "Effects") == 0)
{
LoadEffects(childNode);
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:31,代码来源:ForceFeedbackSystem.cpp
示例3: InitGlobalFileEnums
void CEditorGame::InitGlobalFileEnums(IGameToEditorInterface *pGTE)
{
// Read in enums stored offline XML. Format is
// <GlobalEnums>
// <EnumName>
// <entry enum="someName=someValue" /> <!-- displayed name != value -->
// <entry enum="someNameValue" /> <!-- displayed name == value -->
// </EnumName>
// </GlobalEnums>
//
XmlNodeRef rootNode = GetISystem()->LoadXmlFromFile("Libs/GlobalEnums.xml");
if (!rootNode || !rootNode->getTag() || stricmp(rootNode->getTag(), "GlobalEnums") != 0)
{
// GameWarning("CEditorGame::InitUIEnums: File 'Libs/GlobalEnums.xml' is not a GlobalEnums file");
return;
}
for (int i = 0; i < rootNode->getChildCount(); ++i)
{
XmlNodeRef enumNameNode = rootNode->getChild(i);
const char *enumId = enumNameNode->getTag();
if (enumId == 0 || *enumId == '\0')
{
continue;
}
int maxChilds = enumNameNode->getChildCount();
if (maxChilds > 0)
{
// allocate enough space to hold all strings
const char **nameValueStrings = new const char*[maxChilds];
int curEntryIndex = 0;
for (int j = 0; j < maxChilds; ++j)
{
XmlNodeRef enumNode = enumNameNode->getChild(j);
const char *nameValue = enumNode->getAttr("enum");
if (nameValue != 0 && *nameValue != '\0')
{
// put in the nameValue pair
nameValueStrings[curEntryIndex++] = nameValue;
}
}
// if we found some entries inform CUIDataBase about it
if (curEntryIndex > 0)
{
pGTE->SetUIEnums(enumId, nameValueStrings, curEntryIndex);
}
// be nice and free our array
delete[] nameValueStrings;
}
}
}
示例4: Load
void CMovementTransitions::Load()
{
Reset();
if (!g_pGame->GetCVars()->g_movementTransitions_enable)
return;
string filename = GetXMLFilename();
XmlNodeRef rootNode = gEnv->pSystem->LoadXmlFromFile(filename.c_str());
if (!rootNode || strcmpi(rootNode->getTag(), "MovementTransitions"))
{
GameWarning("Could not load movement transition data. Invalid XML file '%s'! ", filename.c_str());
return;
}
IItemParamsNode *paramNode = g_pGame->GetIGameFramework()->GetIItemSystem()->CreateParams();
paramNode->ConvertFromXML(rootNode);
ReadGeneralParams(paramNode->GetChild("General"));
bool success = ReadTransitionsParams(paramNode->GetChild("Transitions"));
paramNode->Release();
m_isDataValid = success;
}
示例5: Execute
virtual bool Execute(SActivationInfo *pActInfo)
{
bool bResult = false;
SXmlDocument *doc;
if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active)
{
const char* childName = GetPortString(pActInfo, EIP_Name);
const int childIndex = GetPortInt(pActInfo, EIP_Index);
const int childCount = doc->active->getChildCount();
XmlNodeRef ref = NULL;
for (int i = 0, realCount = 0; i < childCount; ++i)
{
ref = doc->active->getChild(i);
if (ref && strcmp(ref->getTag(), childName) == 0)
{
if (++realCount >= childIndex)
{
doc->active->deleteChildAt(i);
bResult = true;
break;
}
}
}
}
return bResult;
}
示例6: LoadParamsFromXml
void CMFXParticleEffect::LoadParamsFromXml(const XmlNodeRef& paramsNode)
{
// Xml data format
/*
<Particle>
<Name userdata="..." scale="..." maxdist="..." minscale="..." maxscale="..." maxscaledist="..." attach="...">particle.name</Name>
<Direction>DirectionType</Direction>
</Particle>
*/
for (int i=0; i<paramsNode->getChildCount(); ++i)
{
XmlNodeRef child = paramsNode->getChild(i);
if (!strcmp(child->getTag(), "Name"))
{
SMFXParticleEntry entry;
entry.name = child->getContent();
if (child->haveAttr("userdata"))
entry.userdata = child->getAttr("userdata");
if (child->haveAttr("scale"))
child->getAttr("scale", entry.scale);
if (child->haveAttr("maxdist"))
child->getAttr("maxdist", entry.maxdist);
if (child->haveAttr("minscale"))
child->getAttr("minscale", entry.minscale);
if (child->haveAttr("maxscale"))
child->getAttr("maxscale", entry.maxscale);
if (child->haveAttr("maxscaledist"))
child->getAttr("maxscaledist", entry.maxscaledist);
if (child->haveAttr("attach"))
child->getAttr("attach", entry.attachToTarget);
m_particleParams.m_entries.push_back(entry);
}
}
SMFXParticleParams::EDirectionType directionType = SMFXParticleParams::eDT_Normal;
XmlNodeRef dirType = paramsNode->findChild("Direction");
if (dirType)
{
const char *val = dirType->getContent();
if (!strcmp(val, "Normal"))
{
directionType = SMFXParticleParams::eDT_Normal;
}
else if (!strcmp(val, "Ricochet"))
{
directionType = SMFXParticleParams::eDT_Ricochet;
}
}
m_particleParams.directionType = directionType;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:60,代码来源:MFXParticleEffect.cpp
示例7: GetFloat
float CWorldState::GetFloat(const char * entityName, char * valueName)
{
// CryLog("CWorldState::GetFloat()");
float result = 0.f;
if(worldStateXml)
{
XmlNodeRef entityNode = worldStateXml->findChild(entityName);
if(entityNode)
{
const uint32 Count = entityNode->getChildCount();
for (uint32 Index = 0; Index < Count; ++Index)
{
const XmlNodeRef currentNode = entityNode->getChild(Index);
if(strcmp(currentNode->getTag(),valueName)==0)
{
currentNode->getAttr("value",result);
break;
}
}
}
else
CryWarning( VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "CWorldState::Failed to get world state value!");
}
else
CryWarning( VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "CWorldState::Failed to get world state value!");
return result;
}
示例8: SetString
void CWorldState::SetString(const char * entityName, char * valueName , string value)
{
// CryLog("CWorldState::SetString()");
if(worldStateXml)
{
XmlNodeRef entityNode = worldStateXml->findChild(entityName);
if(!entityNode)
{
CreateChild(entityName);
entityNode = worldStateXml->findChild(entityName);
}
const uint32 Count = entityNode->getChildCount();
for (uint32 Index = 0; Index < Count; ++Index)
{
XmlNodeRef child = entityNode->getChild(Index);
if(strcmp(child->getTag(),valueName)==0)
{
child->setAttr("value",value);
worldStateXml->saveToFile(szSaveFile);
return;
}
}
//CryLog("CWorldState::CreateString()");
XmlNodeRef child = entityNode->newChild(valueName);
child->setAttr("value",value);
worldStateXml->saveToFile(szSaveFile);
}
else
return;
}
示例9: BuildChildEffects
void CMFXContainer::BuildChildEffects( const XmlNodeRef& paramsNode )
{
const CGameXmlParamReader reader(paramsNode);
const int totalChildCount = reader.GetUnfilteredChildCount();
const int filteredChildCount = reader.GetFilteredChildCount();
m_effects.reserve(filteredChildCount);
for(int i = 0; i < totalChildCount; i++)
{
XmlNodeRef currentEffectNode = reader.GetFilteredChildAt(i);
if (currentEffectNode == NULL)
continue;
const char* nodeName = currentEffectNode->getTag();
if (nodeName == 0 || *nodeName==0)
continue;
TMFXEffectBasePtr pEffect = MaterialEffectsUtils::CreateEffectByName(nodeName);
if (pEffect != NULL)
{
pEffect->LoadParamsFromXml(currentEffectNode);
m_effects.push_back(pEffect);
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:26,代码来源:MFXContainer.cpp
示例10: Init
//-------------------------------------------------------------------------
void CGameRulesStandardState::Init( XmlNodeRef xml )
{
m_pGameRules = g_pGame->GetGameRules();
m_state = EGRS_Intro;
m_lastReceivedServerState = m_state;
m_timeInPostGame = 0.f;
m_introMessageShown = false;
m_isStarting = false;
m_isWaitingForOverrideTimer = false;
m_startTimerOverrideWait = 0.0f;
m_timeInCurrentPostGameState = 0.f;
m_postGameState = ePGS_Unknown;
m_bHaveNotifiedIntroListeners = false;
m_bHasShownHighlightReel = false;
ChangeState(EGRS_Intro);
int numChildren = xml->getChildCount();
for (int i = 0; i < numChildren; ++ i)
{
XmlNodeRef xmlChild = xml->getChild(i);
if (!stricmp(xmlChild->getTag(), "StartStrings"))
{
const char *pString = 0;
if (xmlChild->getAttr("startMatch", &pString))
{
m_startMatchString.Format("@%s", pString);
}
}
}
}
示例11: LoadAntiCheatVars
void CAntiCheatManager::LoadAntiCheatVars(XmlNodeRef child)
{
int numVars = child->getChildCount();
for (int i=0; i<numVars; ++i)
{
XmlNodeRef varsChild = child->getChild(i);
if (varsChild->isTag("Var"))
{
const char* sVarName = varsChild->getAttr("name");
TAntiCheatVarIdx antiCheatVarIdx = FindAntiCheatVarIdx_Float(sVarName);
if (antiCheatVarIdx != eAV_Invalid_Float)
{
varsChild->getAttr("value", m_cheatVarsFloat[antiCheatVarIdx]);
}
else
{
antiCheatVarIdx = FindAntiCheatVarIdx_Int(sVarName);
if (antiCheatVarIdx != eAV_Invalid_Int)
{
varsChild->getAttr("value", m_cheatVarsInt[antiCheatVarIdx]);
}
else
{
CryLog("Unrecognised anti cheat var '%s'", sVarName);
}
}
}
else
{
CryLog("Unrecognised child node '%s'", varsChild->getTag());
}
}
}
示例12: LoadExplosion
void SAmmoParams::LoadExplosion(const XmlNodeRef& ammoParamsNode)
{
static const int maxExplosions = 4;
CGameXmlParamReader reader(ammoParamsNode);
const int childCount = ammoParamsNode->getChildCount();
//int explosionCount = 0;
XmlNodeRef explosions[maxExplosions];
int finalExplosionCount = 0;
for (int i= 0; (i < childCount) && (finalExplosionCount < maxExplosions); ++i)
{
XmlNodeRef child = reader.GetFilteredChildAt(i);
if(child && stricmp(child->getTag(), "explosion") == 0)
{
explosions[finalExplosionCount] = child;
++finalExplosionCount;
}
}
m_explosion_count = finalExplosionCount;
if(m_explosion_count)
{
pExplosions = new SExplosionParams*[m_explosion_count];
for(int i = 0; i < m_explosion_count; ++i)
{
pExplosions[i] = new SExplosionParams(explosions[i]);
}
pExplosion = pExplosions[0];
}
}
示例13: ParseAudioFileEntry
EAudioRequestStatus CAudioSystemImpl_sdlmixer::ParseAudioFileEntry(XmlNodeRef const pAudioFileEntryNode, SATLAudioFileEntryInfo* const pFileEntryInfo)
{
EAudioRequestStatus eResult = eARS_FAILURE;
if ((_stricmp(pAudioFileEntryNode->getTag(), ms_sSDLFileTag) == 0) && (pFileEntryInfo != NPTR))
{
char const* const sFileName = pAudioFileEntryNode->getAttr(ms_sSDLCommonAttribute);
// Currently the SDLMixer Implementation does not support localized files.
pFileEntryInfo->bLocalized = false;
if (sFileName != NPTR && sFileName[0] != '\0')
{
pFileEntryInfo->sFileName = sFileName;
pFileEntryInfo->nMemoryBlockAlignment = m_nMemoryAlignment;
POOL_NEW(SSDLMixerAudioFileEntryData, pFileEntryInfo->pImplData);
eResult = eARS_SUCCESS;
}
else
{
pFileEntryInfo->sFileName = NPTR;
pFileEntryInfo->nMemoryBlockAlignment = 0;
pFileEntryInfo->pImplData = NPTR;
}
}
return eResult;
}
示例14: Assign
void CScriptProperties::Assign( XmlNodeRef &propsNode,IScriptTable* pPropsTable )
{
const char* key = "";
const char* value = "";
int nAttrs = propsNode->getNumAttributes();
for (int attr = 0; attr < nAttrs; attr++)
{
if (!propsNode->getAttributeByIndex( attr,&key,&value ))
continue;
ScriptVarType varType = pPropsTable->GetValueType(key);
switch (varType)
{
case svtNull:
break;
case svtString:
pPropsTable->SetValue( key,value );
break;
case svtNumber:
{
float fValue = (float)atof(value);
pPropsTable->SetValue( key,fValue );
}
break;
case svtBool:
{
bool const bValue = (stricmp(value, "true") == 0) || (stricmp(value, "1") == 0);
pPropsTable->SetValue(key, bValue);
}
break;
case svtObject:
{
Vec3 vec;
propsNode->getAttr(key,vec);
CScriptVector vecTable;
pPropsTable->GetValue( key,vecTable );
vecTable.Set( vec );
//pPropsTable->SetValue( key,vec );
}
break;
case svtPointer:
case svtUserData:
case svtFunction:
// Ignore invalid property types.
break;
}
}
for (int i = 0; i < propsNode->getChildCount(); i++)
{
XmlNodeRef childNode = propsNode->getChild(i);
SmartScriptTable pChildPropTable;
if (pPropsTable->GetValue(childNode->getTag(),pChildPropTable))
{
// Recurse.
Assign( childNode,pChildPropTable );
}
}
}
示例15: LoadAttributes
//------------------------------------------------------------------------
bool CPlayerProfile::LoadAttributes(const XmlNodeRef& root, int requiredVersion)
{
int version = 0;
const bool bHaveVersion = root->getAttr(VERSION_TAG, version);
if (requiredVersion > 0)
{
if (bHaveVersion && version < requiredVersion)
{
GameWarning("CPlayerProfile::LoadAttributes: Attributes of profile '%s' have different version (%d != %d). Updated.", GetName(), version, requiredVersion);
return false;
}
else if (!bHaveVersion)
{
GameWarning("CPlayerProfile::LoadAttributes: Attributes of legacy profile '%s' has no version (req=%d). Loading anyway.", GetName(), requiredVersion);
}
m_attributesVersion = requiredVersion;
}
else
// for default profile we set the version we found in the rootNode
m_attributesVersion = version;
int nChilds = root->getChildCount();
for (int i=0; i<nChilds; ++i)
{
XmlNodeRef child = root->getChild(i);
if (child && strcmp(child->getTag(), "Attr") == 0)
{
const char* name = child->getAttr("name");
const char* value = child->getAttr("value");
const char* platform = child->getAttr("platform");
bool platformValid = true;
if(platform != NULL && platform[0])
{
#if defined(DURANGO)
platformValid = (strstr(platform, "xbox")!=0);
#elif defined(ORBIS)
platformValid = (strstr(platform, "ps4")!=0);
#else
platformValid = (strstr(platform, "pc")!=0);
#endif
}
if (name && value && platformValid)
{
m_attributeMap[name] = TFlowInputData(string(value));
}
}
}
if(m_pManager->HasEnabledOnlineAttributes() && m_pManager->CanProcessOnlineAttributes() && !IsDefault())
{
m_pManager->LoadOnlineAttributes(this);
}
return true;
}