本文整理汇总了C++中XmlNodeRef类的典型用法代码示例。如果您正苦于以下问题:C++ XmlNodeRef类的具体用法?C++ XmlNodeRef怎么用?C++ XmlNodeRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlNodeRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateConnectionFromXMLNode
TConnectionPtr CAudioSystemEditor_wwise::CreateConnectionFromXMLNode(XmlNodeRef pNode, EACEControlType eATLControlType)
{
if (pNode)
{
const string sTag = pNode->getTag();
TImplControlType type = TagToType(sTag);
if (type != AUDIO_IMPL_INVALID_TYPE)
{
string sName = pNode->getAttr("wwise_name");
string sLocalised = pNode->getAttr("wwise_localised");
bool bLocalised = (sLocalised.compareNoCase("true") == 0);
// If control not found, create a placeholder.
// We want to keep that connection even if it's not in the middleware.
// The user could be using the engine without the wwise project
IAudioSystemControl* pControl = GetControlByName(sName, bLocalised);
if (pControl == nullptr)
{
pControl = CreateControl(SControlDef(sName, type));
if (pControl)
{
pControl->SetPlaceholder(true);
pControl->SetLocalised(bLocalised);
}
}
// If it's a switch we actually connect to one of the states within the switch
if (type == eWCT_WWISE_SWITCH_GROUP || type == eWCT_WWISE_GAME_STATE_GROUP)
{
if (pNode->getChildCount() == 1)
{
pNode = pNode->getChild(0);
if (pNode)
{
string sChildName = pNode->getAttr("wwise_name");
IAudioSystemControl* pChildControl = GetControlByName(sChildName, false, pControl);
if (pChildControl == nullptr)
{
pChildControl = CreateControl(SControlDef(sChildName, type == eWCT_WWISE_SWITCH_GROUP ? eWCT_WWISE_SWITCH : eWCT_WWISE_GAME_STATE, false, pControl));
}
pControl = pChildControl;
}
}
else
{
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "Audio Controls Editor (Wwise): Error reading connection to Wwise control %s", sName);
}
}
if (pControl)
{
pControl->SetConnected(true);
++m_connectionsByID[pControl->GetId()];
if (type == eWCT_WWISE_RTPC)
{
switch (eATLControlType)
{
case EACEControlType::eACET_RTPC:
{
TRtpcConnectionPtr pConnection = std::make_shared<CRtpcConnection>(pControl->GetId());
float mult = 1.0f;
float shift = 0.0f;
if (pNode->haveAttr("atl_mult"))
{
const string sProperty = pNode->getAttr("atl_mult");
mult = (float)std::atof(sProperty.c_str());
}
if (pNode->haveAttr("atl_shift"))
{
const string sProperty = pNode->getAttr("atl_shift");
shift = (float)std::atof(sProperty.c_str());
}
pConnection->fMult = mult;
pConnection->fShift = shift;
return pConnection;
}
case EACEControlType::eACET_SWITCH_STATE:
{
TStateConnectionPtr pConnection = std::make_shared<CStateToRtpcConnection>(pControl->GetId());
float value = 0.0f;
if (pNode->haveAttr("atl_mult"))
{
const string sProperty = pNode->getAttr("wwise_value");
value = (float)std::atof(sProperty.c_str());
}
pConnection->fValue = value;
return pConnection;
}
}
}
else
{
return std::make_shared<IAudioConnection>(pControl->GetId());
}
}
}
//.........这里部分代码省略.........
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:101,代码来源:AudioSystemEditor_wwise.cpp
示例2: CryWarning
void CHUDMissionObjectiveSystem::LoadLevelObjectivesInternal(const char* levelpath)
{
CryFixedStringT<128> filename;
if (levelpath==NULL)
{
// there is no Objectives_global.xml, but there is a file with the previous standard naming
// load the file with old name for backwards compatibility
if (!gEnv->pCryPak->IsFileExist("Libs/UI/Objectives_global.xml")
&& gEnv->pCryPak->IsFileExist("Libs/UI/Objectives_new.xml"))
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "File 'Objectives_new.xml' is deprecated and should be renamed to 'Objectives_global.xml'");
filename = "Libs/UI/Objectives_new.xml";
}
else
{
filename = "Libs/UI/Objectives_global.xml";
}
}
else
{
filename.Format("%s/leveldata/Objectives.xml", levelpath);
}
/*if(gEnv->bMultiplayer)
{
CGameRules *pGameRules = g_pGame->GetGameRules();
if(stricmp (pGameRules->GetEntity()->GetClass()->GetName(), "Coop"))
filename = "Libs/UI/MP_Objectives.xml";
}*/
XmlNodeRef missionObjectives = GetISystem()->LoadXmlFromFile(filename.c_str());
if (missionObjectives == 0)
return;
for(int tag = 0; tag < missionObjectives->getChildCount(); ++tag)
{
XmlNodeRef mission = missionObjectives->getChild(tag);
const char* attrib;
const char* objective;
const char* text;
const char* optional;
const char* levelName;
if (!mission->getAttr("name", &levelName))
{
levelName = mission->getTag();
}
for(int obj = 0; obj < mission->getChildCount(); ++obj)
{
XmlNodeRef objectiveNode = mission->getChild(obj);
string id(levelName);
id.append(".");
id.append(objectiveNode->getTag());
if(objectiveNode->getAttributeByIndex(0, &attrib, &objective) && objectiveNode->getAttributeByIndex(1, &attrib, &text))
{
bool secondaryObjective = false;
int attribs = objectiveNode->getNumAttributes();
for(int attribIndex = 2; attribIndex < attribs; ++attribIndex)
{
if(objectiveNode->getAttributeByIndex(attribIndex, &attrib, &optional))
{
if(attrib)
{
if(!stricmp(attrib, "Secondary"))
{
if(!stricmp(optional, "true"))
secondaryObjective = true;
}
}
}
}
m_currentMissionObjectives.push_back(CHUDMissionObjective(this, id.c_str(), objective, text, secondaryObjective));
}
else
GameWarning("Error reading mission objectives.");
}
}
}
开发者ID:amrhead,项目名称:eaascode,代码行数:78,代码来源:HUDMissionObjectiveSystem.cpp
示例3: GetISystem
void COptionsManager::ResetDefaults(const char* option)
{
if(!m_pPlayerProfileManager)
return;
const char* user = m_pPlayerProfileManager->GetCurrentUser();
IPlayerProfile *pProfile = m_pPlayerProfileManager->GetCurrentProfile(user);
if(!pProfile)
return;
XmlNodeRef root = GetISystem()->LoadXmlFile("libs/config/profiles/default/attributes.xml");
bool resetAll = (option==NULL);
bool detectHardware = false;
for (int i = 0; i < root->getChildCount(); ++i)
{
XmlNodeRef enumNameNode = root->getChild(i);
const char *name = enumNameNode->getAttr("name");
const char *value = enumNameNode->getAttr("value");
if(name && value)
{
const char* attribCVar = "";
bool bWriteToCfg = false;
const bool bIsOption = IsOption(name, attribCVar, bWriteToCfg);
if(bIsOption)
{
if(!resetAll && strcmp(attribCVar,option))
continue;
if(!strcmp(attribCVar, "sys_spec_Shadows"))
{
detectHardware = true;
}
if(!strcmp(attribCVar, "hud_colorLine"))
{
CryFixedStringT<32> color;
color.Format("%d", g_pGameCVars->hud_colorLine);
SetCrysisProfileColor(color.c_str());
}
if(!strcmp(attribCVar,"pb_client"))
{
if(atoi(value)==0)
{
m_pbEnabled = false;
gEnv->pConsole->ExecuteString("net_pb_cl_enable false");
}
else
{
m_pbEnabled = true;
gEnv->pConsole->ExecuteString("net_pb_cl_enable true");
}
}
else if(!strcmp(attribCVar, "g_difficultyLevel"))
{
SetDifficulty(value);
}
else
{
ICVar *pCVar = gEnv->pConsole->GetCVar(attribCVar);
if(pCVar)
{
pCVar->Set(value);
}
}
if(!resetAll)
break;
}
}
}
if(detectHardware)
AutoDetectHardware("");
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:72,代码来源:OptionsManager.cpp
示例4: paramReader
void CForceFeedBackSystem::LoadEffects( XmlNodeRef& effectsNode )
{
CGameXmlParamReader paramReader(effectsNode);
const int effectsCount = paramReader.GetUnfilteredChildCount();
m_effectToIndexMap.reserve(effectsCount);
m_effects.reserve(effectsCount);
m_effectNames.reserve(effectsCount);
for (int i = 0; i < effectsCount; ++i)
{
XmlNodeRef childEffectNode = paramReader.GetFilteredChildAt(i);
if( childEffectNode )
{
SEffect newEffect;
const int effectDataCount = childEffectNode->getChildCount();
const char* effectName = childEffectNode->getAttr("name");
//Check for invalid name
if ((effectName == NULL) || (effectName[0] == '\0'))
{
FORCEFEEDBACK_LOG("Could not load effect without name (at line %d)", childEffectNode->getLine());
continue;
}
//Check for duplicates
if (m_effectToIndexMap.find(FFBInternalId::GetIdForName(effectName)) != m_effectToIndexMap.end())
{
FORCEFEEDBACK_LOG("Effect '%s' does already exists, skipping", effectName);
continue;
}
childEffectNode->getAttr("time", newEffect.time);
for (int j = 0; j < effectDataCount; ++j)
{
XmlNodeRef motorNode = childEffectNode->getChild(j);
const char* motorTag = motorNode->getTag();
if (strcmp(motorTag, "MotorAB") == 0)
{
newEffect.patternA.Set( motorNode->haveAttr("pattern") ? motorNode->getAttr("pattern") : "" );
newEffect.patternB = newEffect.patternA;
newEffect.envelopeA.Set( motorNode->haveAttr("envelope") ? motorNode->getAttr("envelope") : "" );
newEffect.envelopeB = newEffect.envelopeA;
motorNode->getAttr("frequency", newEffect.frequencyA);
newEffect.frequencyB = newEffect.frequencyA;
}
else if (strcmp(motorTag, "MotorA") == 0)
{
newEffect.patternA.Set( motorNode->haveAttr("pattern") ? motorNode->getAttr("pattern") : "" );
newEffect.envelopeA.Set( motorNode->haveAttr("envelope") ? motorNode->getAttr("envelope") : "" );
motorNode->getAttr("frequency", newEffect.frequencyA);
}
else if (strcmp(motorTag, "MotorB") == 0)
{
newEffect.patternB.Set( motorNode->haveAttr("pattern") ? motorNode->getAttr("pattern") : "" );
newEffect.envelopeB.Set( motorNode->haveAttr("envelope") ? motorNode->getAttr("envelope") : "" );
motorNode->getAttr("frequency", newEffect.frequencyB);
}
}
newEffect.frequencyA = (float)__fsel(-newEffect.frequencyA, 1.0f, newEffect.frequencyA);
newEffect.frequencyB = (float)__fsel(-newEffect.frequencyB, 1.0f, newEffect.frequencyB);
m_effects.push_back(newEffect);
m_effectNames.push_back(effectName);
FFBInternalId internalId;
internalId.Set(effectName);
m_effectToIndexMap.insert(TEffectToIndexMap::value_type(internalId, ((int)m_effects.size() - 1)));
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:77,代码来源:ForceFeedbackSystem.cpp
示例5: mbstowcs
void CDLCManager::PopulateDLCContents(const XmlNodeRef &rootNode, int dlcId, const char* name )
{
mbstowcs( m_dlcContents[dlcId].name, name, MAX_DLC_NAME );
XmlNodeRef levelsNode = rootNode->findChild("levels");
if (levelsNode)
{
XmlString levelName;
int numLevels = levelsNode->getChildCount();
CryLog( "Found %d levels in the DLC", numLevels );
m_dlcContents[dlcId].levels.reserve(numLevels);
for (int i=0; i<numLevels; ++i)
{
XmlNodeRef levelNode = levelsNode->getChild(i);
if (levelNode->getAttr("name", levelName))
{
CryLog( "Found level %s and added to the DLC manager", levelName.c_str() );
m_dlcContents[dlcId].levels.push_back(levelName);
}
}
}
XmlNodeRef bonusNode = rootNode->findChild("bonus");
if( bonusNode )
{
CryLog( "DLC pak includes a pre-sale bonus" );
uint32 bonusID = 0;
bonusNode->getAttr("id", bonusID );
m_dlcContents[dlcId].bonusID = bonusID;
}
XmlNodeRef uniqueIdNode = rootNode->findChild("uniqueId");
if( uniqueIdNode )
{
uint32 uniqueID = 0;
uniqueIdNode->getAttr("id", uniqueID );
m_dlcContents[dlcId].uniqueID = uniqueID;
}
XmlNodeRef uniqueTagNode = rootNode->findChild("uniqueTag");
if( uniqueTagNode )
{
const char* str = uniqueTagNode->getAttr( "tag" );
m_dlcContents[dlcId].uniqueTag.Format( str );
}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:48,代码来源:DLCManager.cpp
示例6: CryWarning
//////////////////////////////////////////////////////////////////////////
//this respawns the active AI at their spawn locations
void CCheckpointSystem::RespawnAI(XmlNodeRef data)
{
if(!data)
return;
XmlNodeRef actorData = data->findChild(ACTOR_FLAGS_SECTION);
if(!actorData)
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed reading actor data from checkpoint, actors won't be respawned");
return;
}
IActorSystem *pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
//first run through all actors and hide/deactivate them
IActorIteratorPtr it = pActorSystem->CreateActorIterator();
while (IActor *pActor = it->Next())
{
IEntity *pEntity = pActor->GetEntity();
//deactivate all actors
pEntity->Hide(true);
pEntity->Activate(false);
}
//load actorflags for active actors
XmlNodeRef activatedActors = actorData->findChild(ACTIVATED_ACTORS_SECTION);
if(activatedActors)
{
int actorFlags = activatedActors->getNumAttributes();
const char *key;
const char *value;
for(int i = 0; i < actorFlags; ++i)
{
activatedActors->getAttributeByIndex(i, &key, &value);
//format is "idXXX"
CRY_ASSERT(strlen(key)>2);
EntityId id = (EntityId)(atoi(&key[2]));
bool foundEntity = RepairEntityId(id, value);
if(foundEntity)
{
IActor* pActor = pActorSystem->GetActor(id);
if(pActor)
{
pActor->GetEntity()->Hide(false);
pActor->GetEntity()->Activate(true);
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed finding actor %i from checkpoint.", (int)id);
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed finding actor %s from checkpoint, actor is not setup correctly.", value);
}
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Deactivated actors section was missing in checkpoint.");
it = pActorSystem->CreateActorIterator();
//iterate all actors and respawn if active
while (IActor *pActor = it->Next())
{
IEntity *pEntity = pActor->GetEntity();
if(pEntity->GetId() == LOCAL_PLAYER_ENTITY_ID) //don't respawn player
continue;
//we don't respawn deactivated actors
if(!pEntity->IsHidden() && pEntity->IsActive())
{
pActor->SetHealth(0);
pActor->Respawn();
}
else //but we still reset their position
{
pActor->ResetToSpawnLocation();
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:78,代码来源:CheckPointSystem.cpp
示例7: CryWatch
// TODO parameterise and refactor this now its mainly duplicated between the two runs
void CAutoTester::UpdateTestNumClients()
{
if(gEnv->bServer)
{
IGameFramework *pFramework = gEnv->pGame->GetIGameFramework();
int numChannels = 1; //local channel
if(pFramework)
{
INetNub *pNub = pFramework->GetServerNetNub();
if(pNub)
{
numChannels = pNub->GetNumChannels();
}
}
if (numChannels > m_stateData.testNumClients.m_maxNumClientsConnected)
{
m_stateData.testNumClients.m_maxNumClientsConnected=numChannels;
}
float timeSeconds=gEnv->pTimer->GetFrameStartTime().GetSeconds();
CryWatch("time=%f; numClients=%d; maxNumClients=%d; numClientsExpected=%d", timeSeconds, numChannels, m_stateData.testNumClients.m_maxNumClientsConnected, m_stateData.testNumClients.m_numClientsExpected);
if (timeSeconds > m_stateData.testNumClients.m_debugTimer)
{
m_stateData.testNumClients.m_debugTimer = timeSeconds+2.0f;
CryLogAlways("CAutoTester::UpdateTestNumClients() updating time=%f; numClients=%d; maxNumClients=%d; numClientsExpected=%d", timeSeconds, numChannels, m_stateData.testNumClients.m_maxNumClientsConnected, m_stateData.testNumClients.m_numClientsExpected);
}
if (timeSeconds > m_stateData.testNumClients.m_timeOut)
{
CryLogAlways("CAutoTester::UpdateTestNumClients() testing num clients and time has expired. numClients=%d; maxNumClients=%d; numClientsExpected=%d", numChannels, m_stateData.testNumClients.m_maxNumClientsConnected, m_stateData.testNumClients.m_numClientsExpected);
bool passed=false;
string mapName = g_pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel()->GetLevelInfo()->GetName();
string gameRulesName;
gameRulesName = g_pGame->GetGameRules()->GetEntity()->GetClass()->GetName();
XmlNodeRef testCase = GetISystem()->CreateXmlNode();
string nameStr;
nameStr.Format("Level: %s; gameRules: %s; numClients=%d; timeTested=%.1f seconds", mapName.c_str(), gameRulesName.c_str(), numChannels, m_stateData.testNumClients.m_timeOut);
testCase->setTag("testcase");
testCase->setAttr("name", nameStr.c_str());
testCase->setAttr("time", 0);
testCase->setAttr("numClients", numChannels);
testCase->setAttr("maxNumClientsConnected",m_stateData.testNumClients.m_maxNumClientsConnected);
testCase->setAttr("numClientsExpected", m_stateData.testNumClients.m_numClientsExpected);
if (numChannels == m_stateData.testNumClients.m_maxNumClientsConnected)
{
CryLogAlways("CAutoTester::UpdateTestNumClients() testing num clients and time has expired. We have the same number of clients are our maxNumClients %d", numChannels);
if (numChannels == m_stateData.testNumClients.m_numClientsExpected) // may want to remove this check as keeping the number that joined should be sufficient
{
CryLogAlways("CAutoTester::UpdateTestNumClients() testing num clients and time has expired. We have the same number of clients as we expected to have %d", numChannels);
testCase->setAttr("status", "run");
passed=true;
}
else
{
CryLogAlways("CAutoTester::UpdateTestNumClients() testing num clients and time has expired. We DON'T have the same number of clients %d as we expected to have %d", numChannels, m_stateData.testNumClients.m_numClientsExpected);
//testCase->setAttr("status", "failed");
XmlNodeRef failedCase = GetISystem()->CreateXmlNode();
failedCase->setTag("failure");
failedCase->setAttr("type", "NotEnoughClients");
failedCase->setAttr("message", string().Format("testing num clients and time has expired. We DON'T have the same number of clients %d as we expected to have %d", numChannels, m_stateData.testNumClients.m_numClientsExpected));
testCase->addChild(failedCase);
}
}
else
{
//testCase->setAttr("status", "failed");
XmlNodeRef failedCase = GetISystem()->CreateXmlNode();
failedCase->setTag("failure");
failedCase->setAttr("type", "NotEnoughClients");
failedCase->setAttr("message", string().Format("testing num clients and time has expired. We DON'T have the same number of clients %d as we peaked at %d", numChannels, m_stateData.testNumClients.m_maxNumClientsConnected));
testCase->addChild(failedCase);
}
AddTestCaseResult("Test Clients In Levels", testCase, passed);
Stop();
}
}
}
开发者ID:nhnam,项目名称:Seasons,代码行数:95,代码来源:AutoTester.cpp
示例8: InternalMakeFSPath
//------------------------------------------------------------------------
bool CPlayerProfileImplFSDir::LoginUser(SUserEntry* pEntry)
{
// lookup stored profiles of the user (pEntry->userId) and fill in the pEntry->profileDesc
// vector
pEntry->profileDesc.clear();
// scan directory for profiles
string path;
InternalMakeFSPath(pEntry, "", path); // no profile name -> only path
std::multimap<time_t, SLocalProfileInfo> profiles;
ICryPak * pCryPak = gEnv->pCryPak;
_finddata_t fd;
path.TrimRight("/\\");
string search = path + "/*.*";
IPlatformOS* pOS = GetISystem()->GetPlatformOS();
IPlatformOS::IFileFinderPtr fileFinder = pOS->GetFileFinder(IPlatformOS::Unknown_User);
intptr_t handle = fileFinder->FindFirst(search.c_str(), &fd);
if (handle != -1)
{
do
{
if (strcmp(fd.name, ".") == 0 || strcmp(fd.name, "..") == 0)
continue;
if (fd.attrib & _A_SUBDIR)
{
// profile name = folder name
// but make sure there is a profile.xml in it
string filename = path + "/" + fd.name;
filename += "/" ;
filename += "profile.xml";
XmlNodeRef rootNode = LoadXMLFile(filename.c_str());
// see if the root tag is o.k.
if (rootNode && stricmp(rootNode->getTag(), PROFILE_ROOT_TAG) == 0)
{
string profileName = fd.name;
if (rootNode->haveAttr(PROFILE_NAME_TAG))
{
const char* profileHumanName = rootNode->getAttr(PROFILE_NAME_TAG);
if (profileHumanName!=0 && stricmp(profileHumanName, profileName) == 0)
{
profileName = profileHumanName;
}
}
time_t time = NULL;
if (rootNode->haveAttr(PROFILE_LAST_PLAYED))
{
rootNode->getAttr(PROFILE_LAST_PLAYED, time);
}
SLocalProfileInfo info(profileName);
info.SetLastLoginTime(time);
profiles.insert(std::make_pair(time, info));
}
else
{
GameWarning("CPlayerProfileImplFSDir::LoginUser: Profile '%s' of User '%s' seems to exists but is invalid (File '%s). Skipped", fd.name, pEntry->userId.c_str(), filename.c_str());
}
}
} while ( fileFinder->FindNext( handle, &fd ) >= 0 );
fileFinder->FindClose( handle );
}
// Insert in most recently played order
std::multimap<time_t, SLocalProfileInfo>::const_reverse_iterator itend = profiles.rend();
for(std::multimap<time_t, SLocalProfileInfo>::const_reverse_iterator it = profiles.rbegin(); it != itend; ++it)
pEntry->profileDesc.push_back(it->second);
return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:77,代码来源:PlayerProfileImplFS.cpp
示例9: GetISystem
bool CCommonSaveGameHelper::GetSaveGames(CPlayerProfileManager::SUserEntry* pEntry, CPlayerProfileManager::TSaveGameInfoVec& outVec, const char* altProfileName="")
{
// Scan savegames directory for XML files
// we scan only for save game meta information
string path;
string profileName = (altProfileName && *altProfileName) ? altProfileName : pEntry->pCurrentProfile->GetName();
m_pImpl->InternalMakeFSSaveGamePath(pEntry, profileName, path, true);
const bool bNeedProfilePrefix = m_pImpl->GetManager()->IsSaveGameFolderShared();
string profilePrefix = profileName;
profilePrefix+='_';
size_t profilePrefixLen = profilePrefix.length();
path.TrimRight("/\\");
string search;
search.Format("%s/*%s", path.c_str(), CRY_SAVEGAME_FILE_EXT);
IPlatformOS* os = GetISystem()->GetPlatformOS();
IPlatformOS::IFileFinderPtr fileFinder = os->GetFileFinder(IPlatformOS::Unknown_User);
_finddata_t fd;
intptr_t handle = fileFinder->FindFirst(search.c_str(), &fd);
if (handle != -1)
{
CPlayerProfileManager::SSaveGameInfo sgInfo;
do
{
if (strcmp(fd.name, ".") == 0 || strcmp(fd.name, "..") == 0)
continue;
if (bNeedProfilePrefix)
{
if (strnicmp(profilePrefix, fd.name, profilePrefixLen) != 0)
continue;
}
sgInfo.name = fd.name;
if (bNeedProfilePrefix) // skip profile_ prefix (we made sure this is valid by comparism above)
sgInfo.humanName = fd.name+profilePrefixLen;
else
sgInfo.humanName = fd.name;
PathUtil::RemoveExtension(sgInfo.humanName);
sgInfo.description = "no description";
bool ok = false;
// filename construction
#if defined(PS3) || defined(XENON) //don't use meta files on PS3 or 360
sgInfo.metaData.saveTime = static_cast<time_t>(fd.time_write); // the time gets used to find the most recent save
sgInfo.metaData.loadTime = sgInfo.metaData.saveTime;
ok = true;
#else
string metaFilename = path;
metaFilename.append("/");
metaFilename.append(fd.name);
metaFilename = PathUtil::ReplaceExtension(metaFilename, ".meta");
XmlNodeRef rootNode = LoadXMLFile(metaFilename.c_str());
// see if the root tag is o.k.
if (rootNode && stricmp(rootNode->getTag(), "Metadata") == 0)
{
// get meta data
ok = FetchMetaData(rootNode, sgInfo.metaData);
}
else
{
// when there is no meta information, we currently reject the savegame
//ok = true; // un-comment this, if you want to accept savegames without meta
}
// Use the file modified time for the load time as we touch the saves when they are used to keep most recent checkpoint
sgInfo.metaData.loadTime = static_cast<time_t>(fd.time_write);
#endif
if (ok)
{
outVec.push_back(sgInfo);
}
else
{
GameWarning("CPlayerProfileImplFS::GetSaveGames: SaveGame '%s' of user '%s' is invalid", fd.name, pEntry->userId.c_str());
}
} while ( fileFinder->FindNext(handle, &fd) >= 0 );
fileFinder->FindClose( handle );
}
return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:87,代码来源:PlayerProfileImplFS.cpp
示例10: GetISystem
bool CGameTokenSystem::_InternalLoadLibrary( const char *filename, const char* tag )
{
XmlNodeRef root = GetISystem()->LoadXmlFromFile( filename );
if (!root)
{
GameWarning( _HELP("Unable to load game token database: %s"), filename );
return false;
}
if (0 != strcmp( tag, root->getTag() ))
{
GameWarning( _HELP("Not a game tokens library : %s"), filename );
return false;
}
// GameTokens are (currently) not saved with their full path
// we expand it here to LibName.TokenName
string libName;
{
const char *sLibName = root->getAttr("Name");
if (sLibName == 0) {
GameWarning( "GameTokensLibrary::LoadLibrary: Unable to find LibName in file '%s'", filename);
return false;
}
libName = sLibName;
}
// we dont skip already loaded libraries anymore. We need to reload them to be sure that all necessary gametokens are present even if some level has not up-to-date libraries.
if (!stl::find(m_libraries, libName)) //return true;
m_libraries.push_back(libName);
libName+= ".";
int numChildren = root->getChildCount();
for (int i=0; i<numChildren; i++)
{
XmlNodeRef node = root->getChild(i);
const char *sName = node->getAttr("Name");
const char *sType = node->getAttr("Type");
const char *sValue = node->getAttr("Value");
const char *sLocalOnly = node->getAttr("LocalOnly");
int localOnly=atoi(sLocalOnly);
EFlowDataTypes tokenType = eFDT_Any;
if (0 == strcmp(sType,"Int"))
tokenType = eFDT_Int;
else if (0 == strcmp(sType,"Float"))
tokenType = eFDT_Float;
else if (0 == strcmp(sType,"EntityId"))
tokenType = eFDT_EntityId;
else if (0 == strcmp(sType,"Vec3"))
tokenType = eFDT_Vec3;
else if (0 == strcmp(sType,"String"))
tokenType = eFDT_String;
else if (0 == strcmp(sType,"Bool"))
tokenType = eFDT_Bool;
if (tokenType == eFDT_Any)
{
GameWarning(_HELP("Unknown game token type %s in token %s (%s:%d)"),sType,sName,node->getTag(),node->getLine());
continue;
}
TFlowInputData initialValue = TFlowInputData(string(sValue));
string fullName (libName);
fullName+=sName;
IGameToken *pToken = stl::find_in_map(*m_pGameTokensMap,fullName,NULL);
if (!pToken)
{
pToken = SetOrCreateToken( fullName,initialValue );
if (pToken && localOnly)
pToken->SetFlags(pToken->GetFlags()|EGAME_TOKEN_LOCALONLY);
}
}
return true;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:79,代码来源:GameTokenSystem.cpp
示例11: GetIScriptSystem
//////////////////////////////////////////////////////////////////////////
// Set event targets from the XmlNode exported by Editor.
void CScriptProxy::SetEventTargets( XmlNodeRef &eventTargetsNode )
{
std::set<string> sourceEvents;
std::vector<SEntityEventTarget> eventTargets;
IScriptSystem* pSS = GetIScriptSystem();
for (int i = 0; i < eventTargetsNode->getChildCount(); i++)
{
XmlNodeRef eventNode = eventTargetsNode->getChild(i);
SEntityEventTarget et;
et.event = eventNode->getAttr("Event");
if (!eventNode->getAttr("Target", et.target))
et.target = 0; // failed reading...
et.sourceEvent = eventNode->getAttr("SourceEvent");
if (et.event.empty() || !et.target || et.sourceEvent.empty())
continue;
eventTargets.push_back(et);
sourceEvents.insert(et.sourceEvent);
}
if (eventTargets.empty())
return;
SmartScriptTable pEventsTable;
if (!m_pThis->GetValue( "Events",pEventsTable ))
{
pEventsTable = pSS->CreateTable();
// assign events table to the entity self script table.
m_pThis->SetValue( "Events",pEventsTable );
}
for (std::set<string>::iterator it = sourceEvents.begin(); it != sourceEvents.end(); ++it)
{
SmartScriptTable pTrgEvents(pSS);
string sourceEvent = *it;
pEventsTable->SetValue( sourceEvent.c_str(),pTrgEvents );
// Put target events to table.
int trgEventIndex = 1;
for (size_t i = 0; i < eventTargets.size(); i++)
{
SEntityEventTarget &et = eventTargets[i];
if (et.sourceEvent == sourceEvent)
{
SmartScriptTable pTrgEvent(pSS);
pTrgEvents->SetAt( trgEventIndex,pTrgEvent );
trgEventIndex++;
ScriptHandle hdl;
hdl.n = et.target;
pTrgEvent->SetAt( 1, hdl);
pTrgEvent->SetAt( 2,et.event.c_str());
}
}
}
}
开发者ID:joewan,项目名称:pycmake,代码行数:64,代码来源:ScriptProxy.cpp
示例12: min
void CAnimationProxyDualCharacterBase::Generate1P3PPairFile()
{
const int MAX_MODELS = 128;
ICharacterModel *pCharacterModels[MAX_MODELS];
int numModels;
gEnv->pCharacterManager->GetLoadedModels(NULL, numModels);
numModels = min(numModels, MAX_MODELS);
gEnv->pCharacterManager->GetLoadedModels(pCharacterModels, numModels);
s_animCrCHashMap.clear();
for (uint32 i=0; i<numModels; ++i)
{
if (pCharacterModels[i]->GetNumInstances() > 0)
{
IAnimationSet *animSet = pCharacterModels[i]->GetICharInstanceFromModel(0)->GetIAnimationSet();
uint32 numAnims = animSet->GetAnimationCount();
for (uint32 anm = 0; anm < numAnims; anm++)
{
uint32 animCRC = animSet->GetCRCByAnimID(anm);
if (s_animCrCHashMap.find(animCRC) == s_animCrCHashMap.end())
{
int animID3P = -1;
const char *name = animSet->GetNameByAnimID(anm);
if (strlen(name) >= 255)
{
CRY_ASSERT_MESSAGE(0, string().Format("[CAnimationProxyDualCharacterBase::Generate1P3PPairFiles] Animname %s overruns buffer", name));
CryLogAlways("[CAnimationProxyDualCharacterBase::Generate1P3PPairFiles] Animname %s overruns buffer", name);
continue;
}
const char *pos = CryStringUtils::stristr(name, "_1p");
if (pos)
{
char name3P[256];
strcpy(name3P, name);
name3P[(int)(TRUNCATE_PTR)pos + 1 - (int)(TRUNCATE_PTR)name] = '3';
animID3P = animSet->GetAnimIDByName(name3P);
if (animID3P >= 0)
{
uint32 animCRCTP = animSet->GetCRCByAnimID(animID3P);
s_animCrCHashMap[animCRC] = animCRCTP;
}
}
}
}
}
}
//--- Save the file
CryFixedStringT<256> animCrC;
XmlNodeRef nodePairList = gEnv->pSystem->CreateXmlNode( "Pairs" );
for (NameHashMap::iterator iter = s_animCrCHashMap.begin(); iter != s_animCrCHashMap.end(); ++iter)
{
XmlNodeRef nodePair = nodePairList->newChild( "Pair" );
animCrC.Format("%u", iter->first);
nodePair->setAttr( "FP", animCrC.c_str());
animCrC.Format("%u", iter->second);
nodePair->setAttr( "TP", animCrC.c_str());
}
nodePairList->saveToFile(ANIMPAIR_PATHNAME);
s_animCrCHashMap.clear();
Load1P3PPairFile();
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:68,代码来源:DualCharacterProxy.cpp
示例13: ProcessEffectInfo
void CClientHitEffectsMP::ProcessEffectInfo(SHitEffectInfoSet& hitEffectSet, XmlNodeRef xmlNode, const char* libraryName)
{
bool foundDefault = false;
bool foundMelee = false;
const uint numEffects = xmlNode->getChildCount();
IMaterialEffects* pMaterialEffects = gEnv->pMaterialEffects;
IEntityClassRegistry* pClassRegistry = gEnv->pEntitySystem->GetClassRegistry();
hitEffectSet.m_effectInfos.reserve(numEffects);
for (uint i = 0; i < numEffects; i++)
{
if(XmlNodeRef childNode = xmlNode->getChild(i))
{
if(const char* nameTag = childNode->getTag())
{
if(!foundDefault && !strcmp("default", nameTag))
{
const char* effectName = childNode->getAttr("effect");
if(effectName)
{
hitEffectSet.m_default = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
}
foundDefault = true;
}
else if(!foundMelee && !strcmp("melee", nameTag))
{
const char* effectName = childNode->getAttr("effect");
if(effectName)
{
hitEffectSet.m_melee = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
}
foundMelee = true;
}
else
{
SHitEffectInfo newInfo;
newInfo.pAmmoClass = pClassRegistry->FindClass(nameTag);
const char* effectName = childNode->getAttr("effect");
if(effectName)
{
newInfo.effectId = pMaterialEffects->GetEffectIdByName(libraryName, effectName);
}
if(newInfo.pAmmoClass && newInfo.effectId)
{
hitEffectSet.m_effectInfos.push_back(newInfo);
}
else
{
if(!newInfo.pAmmoClass)
{
GameWarning("Class type %s does not exist", nameTag);
}
if(!newInfo.effectId)
{
GameWarning("Material Effect %s does not exist", effectName ? effectName : "");
}
}
}
}
}
}
if(!hitEffectSet.m_melee)
{
hitEffectSet.m_melee = hitEffectSet.m_default;
}
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:77,代码来源:ClientHitEffectsMP.cpp
示例14: GetControl
XmlNodeRef CAudioSystemEditor_wwise::CreateXMLNodeFromConnection(const TConnectionPtr pConnection, const EACEControlType eATLControlType)
{
const IAudioSystemControl* pControl = GetControl(pConnection->GetID());
if (pControl)
{
switch (pControl->GetType())
{
case AudioControls::eWCT_WWISE_SWITCH:
case AudioControls::eWCT_WWISE_SWITCH_GROUP:
case AudioControls::eWCT_WWISE_GAME_STATE:
case AudioControls::eWCT_WWISE_GAME_STATE_GROUP:
{
const IAudioSystemControl* pParent = pControl->GetParent();
if (pParent)
{
XmlNodeRef pSwitchNode = GetISystem()->CreateXmlNode(TypeToTag(pParent->GetType()));
pSwitchNode->setAttr("wwise_name", pParent->GetName());
XmlNodeRef pStateNode = pSwitchNode->createNode("WwiseValue");
pStateNode->setAttr("wwise_name", pControl->GetName());
pSwitchNode->addChild(pStateNode);
return pSwitchNode;
}
}
break;
case AudioControls::eWCT_WWISE_RTPC:
{
XmlNodeRef pConnectionNode;
pConnectionNode = GetISystem()->CreateXmlNode(TypeToTag(pControl->GetType()));
pConnectionNode->setAttr("wwise_name", pControl->GetName());
if (eATLControlType == eACET_RTPC)
{
std::shared_ptr<const CRtpcConnection> pRtpcConnection = std::static_pointer_cast<const CRtpcConnection>(pConnection);
if (pRtpcConnection->fMult != 1.0f)
{
pConnectionNode->setAttr("atl_mult", pRtpcConnection->fMult);
}
if (pRtpcConnection->fShift != 0.0f)
{
pConnectionNode->setAttr("atl_shift", pRtpcConnection->fShift);
}
}
else if (eATLControlType == eACET_SWITCH_STATE)
{
std::shared_ptr<const CStateToRtpcConnection> pStateConnection = std::static_pointer_cast<const CStateToRtpcConnection>(pConnection);
pConnectionNode->setAttr("wwise_value", pStateConnection->fValue);
}
return pConnectionNode;
}
break;
case AudioControls::eWCT_WWISE_EVENT:
{
XmlNodeRef pConnectionNode;
pConnectionNode = GetISystem()->CreateXmlNode(TypeToTag(pControl->GetType()));
pConnectionNode->setAttr("wwise_name", pControl->GetName());
return pConnectionNode;
}
break;
case AudioControls::eWCT_WWISE_AUX_BUS:
{
XmlNodeRef pConnectionNode;
pConnectionNode = GetISystem()->CreateXmlNode(TypeToTag(pControl->GetType()));
pConnectionNode->setAttr("wwise_name", pControl->GetName());
return pConnectionNode;
}
break;
case AudioControls::eWCT_WWISE_SOUND_BANK:
{
XmlNodeRef pConnectionNode = GetISystem()->CreateXmlNode(TypeToTag(pControl->GetType()));
pConnectionNode->setAttr("wwise_name", pControl->GetName());
if (pControl->IsLocalised())
{
pConnectionNode->setAttr("wwise_localised", "true");
}
return pConnectionNode;
}
break;
}
}
return nullptr;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:88,代码来源:AudioSystemEditor_wwise.cpp
示例15: ScanXML
//------------------------------------------------------------------------
bool CWeaponSystem::ScanXML(XmlNodeRef &root, const char *xmlFile)
{
if (strcmpi(root->getTag(), "ammo"))
return false;
const char *name = root->getAttr("name");
if (!name)
{
GameWarning("Missing ammo name in XML '%s'! Skipping...", xmlFile);
return false;
}
const char *className = root->getAttr("class");
if (!className)
{
GameWarning("Missing ammo class in XML '%s'! Skipping...", xmlFile);
return false;
}
TProjectileRegistry::iterator it = m_projectileregistry.find(CONST_TEMP_STRING(className));
if (it == m_projectileregistry.end())
{
GameWarning("Unknown ammo class '%s' specified in XML '%s'! Skipping...", className, xmlFile);
return false;
}
const char *scriptName = root->getAttr("script");
IEntityClassRegistry::SEntityClassDesc classDesc;
classDesc.sName = name;
classDesc.sScriptFile = scriptName?scriptName:"";
//classDesc.pUserProxyData = (void *)it->second;
//classDesc.pUserProxyCreateFunc = &CreateProxy<CProjectile>;
classDesc.flags |= ECLF_INVISIBLE;
IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindCla
|
请发表评论